2

I know I'm missing something incredibly simple here, but I can't figure out what it is. If I use the following script:

tell application "Adobe Photoshop CS5.1"
open file "path:to:some:file"
end tell

it works no problem, but if I try to use the "choose file" dialog everything falls apart:

tell application "Adobe Photoshop CS5.1"
    set myFile to choose file
    open myFile
end tell

I get an error

error "Adobe Photoshop CS5.1 got an error: File some object wasn’t found." number -43

What am I missing here?

1
  • Did you try appending as POSIX file onto the choose file? Your first script suggests that the open command only takes file references in a certain way. Commented Dec 22, 2011 at 15:51

2 Answers 2

3

For some reason, Photoshop CS5.1 dropped support for opening alias based file references.

You'll need to convert the path to a string and prefix the myFile variable with file.

tell application "Adobe Photoshop CS5.1"
    set myFile to (choose file) as string
    open file myFile
end tell
Sign up to request clarification or add additional context in comments.

Comments

0

It works in Photoshop CS3. I don't have CS5 so I can't test it.

An easier alternative would be to use:

tell application "Adobe Photoshop CS3"
activate
tell application "System Events"
key code 31 using command down
end tell
end tell

You could also try Automator.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.