I have been using the ID of application files for years to identify which version of an application is installed.
tell application "Finder"
set psd_path to (application file id "8BIM") as string -- return path to Photoshop
end tell
A few days ago, I noticed that I can’t use the creator code of FileMaker 7 or 8 with this method.
tell application "Finder"
set fm_path to (application file id "FMP7") as string -- this returns an error
end tell
I ran every system maintenance utility I could think of to no avail. A web search turned up tech note 2106 on Apple’s site, relating to scripting interface guidelines. I found this:
Searching the Applescript Finder Guide made no mention of this bundle id form.
Now here’s the point where I felt like I had fallen down the rabbit hole in Wonderland. On two different Macs, I get different error codes when I use the creator type. One machine returns either -1700 or -1728, while the other machine always returns -10814. Can anyone shed any light on this situation?
Nothing except for stick using the CFBundleIdentifier: “com.filemaker.pro7” (“com.filemaker.pro8” for FMP8, “com.filemaker.pro7D” for FMP7 Dev, etc.).
I use this in one of my apps:
set FMPath to locateFM()
to locateFM()
--> if there are several copies of FM, we will locate the first existing one using this order
--> please, note that FMP9 actually doesn't exist, btw ;-)
--> FMP5 stands for both FMP5 and FMP6
set possibleThings to {"com.filemaker.pro9", "com.filemaker.pro9D", "com.filemaker.pro8", "com.filemaker.pro8D", "com.filemaker.pro7", "com.filemaker.pro7D", "FMP7", "FMP5"}
set FMPRO to ""
--> first try to locate running app, just in case there are several FM copies
repeat with i in {"FMP7", "FMP5"}
set i to i as text
try
tell application "Finder" to ¬
set FMPRO to (get application file of (get first process whose creator type is i)) as text
return result
end try
end repeat
repeat with i from 1 to count possibleThings
try
tell application "Finder"
application file id (possibleThings's item i)
set FMPRO to result as text
end tell
exit repeat
end try
end repeat
return FMPRO
end locateFM