tell application "Adobe Photoshop CS5.1"
set myFile to (choose file) as string
open file myFile
end tell
這導致2個單獨的對話框中打開要我開什麼文件....這不要緊,我選擇第一,它要求第二時間並打開第二個。Photoshop的腳本與AppleScript的 - 不會打開圖像,而無需提示
我想打開一個PDF,所以我真的想:
tell application "Adobe Photoshop CS5.1"
set myFile to (choose file) as string
open file myFile as PDF with options {class:PDF open options, mode:CMYK, resolution:300, use antialias:true, page:1} showing dialogs never
end tell
結果:
Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop
好一個更直接的方法:
tell application "Adobe Photoshop CS5.1"
set myFilePath to alias "other: PREPRESS SAVE:GAMES:3Sudoku:20120213pzsud-v:sudoku 0213.pdf"
with timeout of 300 seconds
open myFilePath as PDF with options {class:PDF open options, mode:CMYK, resolution:300, use antialias:true, page:1}
end timeout
end tell
文件存在或別名的設置將失敗。那我該得到什麼?
"Error: -43. Adobe Photoshop CS5.1 got an error: File some object wasn’t found."
I had asked over on the Adobe forums, with no response.我真的想使用的完整代碼在那裏,如果你有興趣。我將它簡化爲基本知識來找出問題所在。
有沒有一個設置我失蹤的地方?我不確定什麼是錯的,例如
我能夠找到的東西,我會嘗試設置圖像(選擇提示文件「請選擇一個圖像文件:」)作爲字符串 - 這是從AppleScript的標準版AddAdditions 告訴應用程序「Adobe Photoshop CS5」 打開別名theImage - 「打開文件theImage」也應該工作(不帶引號)。 結束告訴 – Lithodora 2012-02-14 11:52:41