In AppleScript programs executed by PowerSwitch or SwitchScripter you can refer to the Switch host application through the string "Current_Switch_Server" (or "Current_SWITCH_Server"). The string is automatically replaced by the appropriate application name before the AppleScript is compiled.
For example:
tell application "Current_Switch_Server" set theJobPath to path of j set theJobProper to proper name of j set theJobName to name of jend tell
AppleScript programs that may be executed in LightSwitch or FullSwitch as a scripted plug-in must use a run-time mechanism to select the appropriate host application (because it's no longer possible to replace strings in the compiled binary contained in the script package). So in this case, you must refer to the global variable ‘Current_Switch_Server’ provided by Switch as follows:
using terms from application "Current_Switch_Server" tell application Current_Switch_Server … end tellend using terms from
If the name of the target application is constant, and if it doesn’t matter that the target application gets referenced (or sometimes even launched) when the script is first executed, the script can use the regular compile-time mechanism:
tell application "QuarkXPress" …end tell
Otherwise the script must use the following run-time mechanism:
if … then set quarkName to "QuarkXPress"else set quarkName to "QuarkXPress Passport"end ifusing terms from application "QuarkXPress" tell application quarkName … end tellend using terms from