Lithodora
Lithodora

Reputation: 338

Photoshop Scripting with Applescript -- will not open images without a prompt

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

This results in 2 separate dialogs opening asking me what file to open.... It doesn't matter what I select first, it asks a second time and opens the second.

What I want to open is a PDF, so I really want:

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

Result:

Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop

All right a more direct approach:

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

The file exists or the setting of the alias would fail. So what do I get?

 "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. The full code I'm really trying to use is there if you're interested. I reduced it to basics to figure out what the problem is.

Is there a setting somewhere that I am missing? I'm not sure what is wrong, the example out of the

Upvotes: 2

Views: 1181

Answers (2)

tompaman
tompaman

Reputation: 104

There are horrible issues with The Photoshop 5 dictionary. One idea is to try and run it in 32-bit mode which 'solves' a lot of issues. Please digest further in http://forums.adobe.com/message/2822670#2822670?tstart=0#2822670

Upvotes: 1

Flambino
Flambino

Reputation: 18773

Might be a CS5 issue, but I honestly don't know.

This worked fine for me, but with 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

The only real difference (that I can see) is that I alias the chosen file, and call open ... - not open file ...

Upvotes: 1

Related Questions