I have “Adobe Photoshop CS5.1” but I need to send a script to a friend with “Adobe Photoshop CS5”
It’s a simple script, and I know the script will work e.g. (but not quite this simple!)
tell application “Adobe Photoshop CS5”
but i can’t save it. the compiler wants to know where “Adobe Photoshop CS5” is. If i tell it it is 5.1, it then amends the script to say 5.1
How can I get the script to get past the compiler when I don’t have that App?
You can’t save the script because you can’t compile it without the application. Here’s what you might do instead… you send him 2 files. One is a standard text file containing the applescript code. The second file compiles the first file into a script. For example I can save this text file to my desktop. I named it “TextEdit.txt”.
tell application “TextEdit” to activate
Next I can run this applescript to compile the text file.
set txtFile to choose file
tell application "Finder"
set theName to name of txtFile
set nmExt to name extension of txtFile
if nmExt is not "" then set theName to text 1 thru -((count of nmExt) + 2) of theName
set theContainer to container of txtFile as text
do shell script "osacompile -o " & quoted form of POSIX path of (theContainer & theName & ".scpt") & space & quoted form of POSIX path of txtFile
If you compile it with the version you have and send it to the other person as a compiled .scpt or .app file, you don’t have to do anything – it will open fine on their Mac.
The other option is to use the id:
tell application id "com.adobe.Photoshop"
Oh, you’re right Shane, I thought he was saying he didn’t have photoshop… but on second read of course version 5.1 versus 5 won’t matter.