Photoshop脚本与Applescript - 没有提示将无法打开图像

时间:2012-02-11 22:38:39

标签: pdf automation applescript photoshop

tell application "Adobe Photoshop CS5.1"
set myFile to (choose file) as string
open file myFile
end tell

这导致2个单独的对话框打开,询问我要打开哪个文件....我先选择的是什么并不重要,它会再次询问并打开第二个。

我想要打开的是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.如果您有兴趣,我真正想要使用的完整代码就在那里。我把它简化为基础知识,找出问题所在。

我遗失的地方有没有设置?我不知道出了什么问题,

中的例子

2 个答案:

答案 0 :(得分:1)

可能是CS5问题,但老实说我不知道​​。

这对我来说很好,但是对于CS4:

tell application "Adobe Photoshop CS4"
    set myFile to (choose file) as alias
    with timeout of 300 seconds
        open myFile as PDF with options {class:PDF open options, mode:CMYK, resolution:300, use antialias:true, page:1}
    end timeout
end tell

唯一真正的区别(我可以看到)是我alias所选文件,并致电open ... - 而不是open file ...

答案 1 :(得分:1)

Photoshop 5词典存在可怕的问题。一个想法是尝试以32位模式运行它,这解决了很多问题。请在http://forums.adobe.com/message/2822670#2822670?tstart=0#2822670

中进一步消化