Quick question, anyone know how to keep Script Editor from automatically updating the version of application contained within the tell block?
Here’s my problem (for reasons I won’t go into) I have scripts I’ve written for both Photoshop 7 and Photoshop CS3 respectfully. Both versions are installed on my computer and depending on the task, I want one or the other to activate and run a specific task. Perplexing . . . perhaps, but it was easy enough for me to keep em both straight.
HOWEVER - if I edit a script I’ve setup to run in Photoshop 7 (and happen to have CS3 open) Script Editor automatically changes the . . .
tell application "Adobe Photoshop 7.0"
end tell
to
tell application "Adobe Photoshop CS3"
end tell
and visa-versa. No biggy if I just opened the script for reference “ I can close it (as well as whatever WRONG version of PS I might have open) then open the script up again and it remains set to my default. BUT if I happen to edit and save something while the wrong version of Photoshop is open then I got a mess on my hands.
Anyone know if there’s a way to stop Script Editor from automatically updating the version of my app? I’m thinking probably not, but just putting it out there.
Thanks for the reply Tom, unfortunately my knowledge and command of shell script is pretty much cut and paste.
Was I supposted to fill in my own specific path to my applications with this code you posted? - Either way I couldnt get it to work.
I would be interested in knowing if, say, I launched the correct application (even though the proceeding appleScript would be calling upon a different version), would it still try to launch in what it was told OR would the shell script trump it and the tell block change at run time? I know it would if i were to load the script . . .
Hi Tom,
it’s strongly recommended not to move Apple or Adobe apps away from their origin location,
the updater applications could fail, if the applications are somewhere else
do shell script "open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop CS3.app'
i though it was something simple like a direct path to my application.
I’m not sure if I messed with something by running Tom’s originally posted shell script but in doing the following I get two seperate errors;
do shell script "open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop CS3.app"
i get the following error:
“sh: -c: line 1: unexpected EOF while looking for matching `‘’
sh: -c: line 2: syntax error: unexpected end of file”
BUT when I try to do
i get hit back with:
“2008-10-11 05:59:28.930 open[4826] No such file: /Photoshop”
I’m a little more concerned with the last error as I’m wondering if I didn’t inadvertently move Photoshop 7 in my initial run through (though it looks to me like every is still in place).
With all that being said, Nigel your suggestion was just what I was after - Thanks! Didn’t know you could include the path within in the “tell application” - great in that it won’t automatically try and change itself regardless of the current status of its brethren. Some issues with having both versions running at the same time (in fact PS 7 wont even launch at all if CS3 is currently running) but I can fix that with something like:
tell application "System Events"
set wrongProgram to count (every process whose name is "Adobe Photoshop CS3")
end tell
at the front of my scripts, promptly followed by a “quit” command if open!
EDIT:
nevermind about the two separate errors - In posting the code I can see now that I left out an apostrophe or something in my second version. Now I get the same error for PS7 as I do for CS3. But if someone could easy my mind as to why the shell script still fails to execute it would be much appreciated.
As far as the problems with the shell script are concerned, you need to quote the paths to the Photoshop app. The first error occurs, because you forgot one apostrophe at the end of the command and the second error occurs, because you did not use any quotes at all.
A safe way is to do it like follows:
set applpath to "/Applications/Adobe Photoshop CS3/Adobe Photoshop CS3.app"
set command to "open -a " & quoted form of applpath
do shell script command