In this shop on any single computer there are likely to be more than one copy of FileMaker Pro: FileMaker Pro 4, FileMaker Pro 6 (Classic), FileMaker Pro 6 (for OS X), FileMaker Unlimited, FileMaker Developer, etc etc etc. Furthermore, the copy currently running and existing as client of my database may or may not be renamed to “FileMaker Pro 6” or whatever. For these reasons, “tell the application ‘FileMaker Pro’” is a tricky business I generally avoid through the sneaky tactic of “tell the current application” insofar as FmPro itself executes the AppleScript as part of a FileMaker script and is therefore “current application”.
But now I’m in a routine where I have FileMaker telling other apps to do things, so that at the point I need to have AppleScript pass a value BACK to a FmPro field FileMaker is no longer the “current application”.
And if I end the AppleScript in mid-FileMaker-script and do something to bring FmPro to the front, the AppleScript variable that I’ve defined and set to a parameter earlier does not persist — e.g.,
tell the application "Terminal"
activate
do stuff
if the contents of window 1 contains "thestring"
set TheVariable to "yeah"
end if
end tell
followed by, in Filemaker
Refresh Window [bring to front]
Perform AppleScript →
tell the current application
set cell "CellName" to TheVariable as string
end tell
…doesn’t work because TheVariable doesn’t persist.
So what I want to do is something akin to this (except, of course, that it should WORK, which the following does not):
tell the current application
set MyFmPro to the process of the current application
end tell
tell the application "Terminal"
activate
do stuff
if the contents of window 1 contains "thestring"
set TheVariable to "yeah"
end if
do other stuff
end tell
if TheVariable="yeah"
tell the application MyFmPro
set cell "CellName" to "yeah"
end tell
(I need versions of this to run under both 9 and X, btw)