Apple Script
for Sketch.app を書こうとしてい(com.bohemiancoding.sketch3)
ます。私がやりたいことは、Sketch ドキュメントからブラウザーでレンダリングできる画像ファイルを作成することです。
そして、Sketch.app辞書を開くとScript Editior
、
saveable file format enum
Sketch : The native Sketch 2 file format
PDF : Portable Document Format
TIFF : Tagged Image File Format
そこで以下のスクリプトで生成しようと思ったのですTIFF
がうまくいきませんでした
tell application "Sketch"
set curdoc to document 0
save curdoc in "/Users/mirza/Downloads/mew2" as TIFF
end tell
.sketch
保存コマンドを使用して形式でスケッチ コピーを作成できますが、PDF や TIFF は作成できません。スケッチは Apple スクリプトを使用した PDF と TIFF をサポートしていますか?
または、そのための他の方法がありますか。
アップデート
パスを Apple スクリプト形式に変更し、ドキュメント インデックスを 1 に設定します。スクリプトは次のようになります。
set thisFilePath to (POSIX file "/Users/mirza/Downloads/mew2")
log thisFilePath
tell application "Sketch"
curdoc to document 1
save curdoc in thisFilePath as TIFF -- Tried with quotes as well, gives same error
end tell
しかし、スクリプトを実行すると、次のエラーが発生しました
Result:
error "Sketch got an error: Can’t continue curdoc." number -1708
更新 2
タイプミスを修正
set thisFilePath to (POSIX file "/Users/mirza/Downloads/mew2")
log thisFilePath
tell application "Sketch"
set curdoc to document 1
log (path of curdoc)
save curdoc in thisFilePath as "TIFF"
end tell
しかし、スクリプトを実行すると、次のエラーが発生しました
Result:
error "Sketch got an error: The document cannot be exported to the \"TIFF\" format." number -50