I’m trying to concoct a folder path with a file name to make a valid path but it isn’t working, though the path looks just a like the path to the file in the terminal. Why doesn’t the following work?
set imageToOpen to theDirectory & imageName as Unicode text
tell application "Finder"
set theImage to quoted form of POSIX file imageToOpen
end tell
Basically I’m getting path to theDirectory by (choose Folder) method, and then I’m typing in a existing file
name at that path. I’ve tried several different methods (quoted form of POSIX path, alias) and combinations
of those with no success.
thanks for the quick response Stefan, that got rid of the error and the path still looks right, but Photoshop won’t open either. Hm. Just when I think I understand file paths…
I’m testing this on a file on my desktop, but eventually it’ll lead to a path on an NT server, so I’ll
be using the posix form.
set a to (choose folder)
set imageName to "thefile.psd"
set imageToOpen to (a as text) & imageName
tell application "Adobe Photoshop CS4"
activate
open imageToOpen
end tell
You need to coerce the string to an alias or put in a file designator for photoshop to open it:
set a to (choose folder)
set imageName to "keep_calm_boutique_main.jpg"
set imageToOpen to (a as text) & imageName
tell application "Adobe Photoshop CS3"
activate
open alias imageToOpen
end tell
or
set a to (choose folder)
set imageName to "keep_calm_boutique_main.jpg"
set imageToOpen to (a as text) & imageName
tell application "Adobe Photoshop CS3"
activate
open file imageToOpen
end tell