2012-02-11 51 views
2
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.我真的想使用的完整代码在那里,如果你有兴趣。我将它简化为基本知识来找出问题所在。

有没有一个设置我失踪的地方?我不确定什么是错的,例如

回答

1

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

+0

我能够找到的东西,我会尝试设置图像(选择提示文件“请选择一个图像文件:”)作为字符串 - 这是从AppleScript的标准版AddAdditions 告诉应用程序“Adobe Photoshop CS5” 打开别名theImage - “打开文件theImage”也应该工作(不带引号)。 结束告诉 – Lithodora 2012-02-14 11:52:41

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 ...

+0

进一步消化这在CS4中工作,也许这是真正的解决方案。在CS5中,这导致:“错误:-43。Adobe Photoshop CS5.1出现错误:找不到文件。” – Lithodora 2012-02-12 01:07:42

相关问题