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