Target applications in tell statements

Referring to Switch

In AppleScript, programs executed by Switch or SwitchScripter can be referred 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 j   
end tell

Referring to Switch from a scripted plug-in

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:

set Current_Switch_Server to system attribute "Current_Switch_Server" 
tell application Current_Switch_Server 
using terms from application "Current_Switch_Server"  
end using terms from 
end tell

Referring to third-party application

If the name of the target application is constant, and if it does not 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 if 
 
using terms from application "QuarkXPress" 
tell application quarkName         
end tell 
end using terms from

In the "using terms from application" statement, specify the application name that is currently installed in the script writer's system. For the above example, "QuarkXPress" application should be installed, not "QuarkXPress Passport". If the script writer has "QuarkXPress Passport" installed, write "using terms from application "QuarkXPress Passport"". Afterwards the script may be executed with "QuarkXPress" as well as with "QuarkXPress Passport".