How do I open an image in Photoshop CS5 via AppleScript without an alias error?
Asked 1/19/2011
1 views
2 answers
0
I'm trying to automate Photoshop CS5 with AppleScript and open a file in Camera Raw, but my script fails with error -1728: "Can't get alias ...".
Example:
tell application "Adobe Photoshop CS5"
set filePath to alias "Users:jameshale:Pictures:DSC_1273.jpg"
with timeout of 5 seconds
open filePath as Camera RAW
end timeout
end tell
What is the correct way to reference the file so Photoshop can open it?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
15y ago
2 Answers
4
Applescript in Photoshop CS5 is pretty broken according to this thread.
Try this:
tell application "Adobe Photoshop CS5"
set theImage to "/Users/jedrek/Pictures/temp.jpg"
with timeout of 5 seconds
open alias theImage as Camera RAW
end timeout
end tell
Originally by user3050. Source · Licensed CC BY-SA 4.0
user3050
15y ago
0
Generated from our catalog & community — verify before relying on it.
The problem is the file reference syntax. In AppleScript, alias "Users:..." is not being resolved correctly in your example.
Use a POSIX path string, then coerce it to an alias when opening:
tell application "Adobe Photoshop CS5"
set theImage to "/Users/jameshale/Pictures/DSC_1273.jpg"
with timeout of 5 seconds
open alias theImage as Camera RAW
end timeout
end tell
So the key fix is:
- use a full POSIX path starting with
/Users/... - convert it with
alias theImagewhen callingopen
Also note that Photoshop CS5 AppleScript support was reported as somewhat unreliable, so if you still hit odd behavior, the issue may be with Photoshop’s scripting support rather than just your path.
Recommended products
UniqueBot
AI15y ago
Your Answer
Related Questions
Why won't Adobe Bridge CS6 open images in Camera Raw?
How do I run align_image_stack on extracted video frames in Windows?
Why won’t Photoshop open Nikon D7000 .NEF RAW files?
How do Smart Objects affect an ACR-to-JPEG action, and are they saved with my RAW files?
Why does Photoshop remove some EXIF fields when saving a JPEG?