Eliminating "tell application FOO..." --> Where

I now have the functioning AppleScript routine in FileMaker that will cue up a 3rd party app and tell it to do things I need to have done.

Problem is, initial experimentation indicates that after setting up and saving the 'Script on one Mac, going to a second Mac to test it initially causes a dialog to pop up asking where the heck the application might be sitting. (The app in question happens to be MacSSH PPC but I’ve seen similar dialogs make an appearance w/o regards to what app is referenced, aside from Finder or the program issuing the AppleScript command itself).

I’d like to eliminate the possibility (or at least reduce the likelihood) of my end users getting a dialog “Where is MacSSH PPC? — Cancel / OK”. Not just because many of 'em couldn’t find their nether regions with their own distal upper-extremity clasping units with or without aid of alkaline-cell-powered incandescent devices, although that’s a factor: I also really don’t want them to have an opportunity to cancel this scripted operation.

• If I install the app to the same general path on each machine, give or take the variations in volume name (sometimes “Macintosh HD” sometimes other things), will that generally suffice? (We’ll also assume the app itself doesn’t get renamed or anything)

• If not, is there an AppleScript command that will more effectively ferret out and launch the little bugger, something like, oh I dunno, “tell the application Finder / activate / set MySSH to list applications where creator = Ssh2 / set WhereSSHLives to the path of item1 of MySSH / select file WhereSSHLives / open selection” – ??? Anyone got one of those handy that works that they could post for me to repurpose?

Create an Applescript to get the name of the application:

tell application "Finder"
	set x to name of application file id "8BIM"
end tell

and store this in a FileMaker global text field:
“g_ps_name”

Then create your Applescript in your script editor of choice.
Then, substitute

in every Photoshop tell block. So every tell block is:

tell application "xxx_ps_name"
	activate
	-- your commands go here
end tell

Store your Applescript into another global text field in FileMaker, “g_AS_photoshop”. Now you need a third global field in FileMaker. I usually call it “g_AS_ready”. Now create a FileMaker script that will substitute the name of Photoshop.

Set Field[“g_AS_ready”, “Substitute(g_AS_photoshop, “xxx_ps_name”, g_ps_name)”]

Now the FileMaker field “g_AS_ready” contains an Applescript that will work on any machine. Just choose the global field “g_AS_ready” as the field that contains your script. I think when you store an applescript as “Script Text” in a FileMaker script, it is compiled and stored that way. But, an Applescript stored in a global field compiles when you run the FileMaker script.
I hope this makes sense. I began using this technique over a year ago and i works great. I work in a large pre-press shop and we deal with QuarkXpress versions 3,4, 5 and 6. This method has been a invaluable to me. Frankly, I can’t believe it isn’t discussed more often. I’m not the sharpest tack in the pack but I stumbled onto it so I know others must be using it.

The routine you’ve described works to obtain the exact name of the application (would be useful if there was a risk that someone had renamed the file to, I dunno, “SSH” or something). But the problem I’ve observed occurs where the location of the application, not its name, seems to be posing the problem.

I’m not seeing how the routine described above addresses that. As I said, “assume for now that the name of the app has not been changed”.

(Nevertheless, thanks for the tip! I’ll see if I can substitute “path” for “name” and get what I want…)

Aha!



tell the application "Finder"
activate
set WhereMacSSHLives to application file id "Ssh2"
end tell

yields;

the result file “MacSSH PPC” or folder “MacSSH PPC” of folder “The Outside World” of disk “Quantum 3.2-A” of application “Finder”

:slight_smile: I can do a “select ” / “open selection” from that !

Thanks for setting me on the right (pardon the expression) path!