Specifications

Script packages
Starting with Switch 08, SwitchScripter stores the compiled binary form of the AppleScript in the
Switch script package (in addition to the source code) to avoid recompilation at execution time.
This has several advantages:
It is possible to execute portions of the script that do not need the target application (such
as perhaps a property validation entry point) without launching the application.
The name of a target application can be determined at run-time by the script (as long as the
dictionaries for the alternative applications are compatible).
There is a small performance gain because the compilation process is skipped.
Editing AppleScript on Windows
When you edit AppleScript source code on Windows, SwitchScripter is unable to generate the
compiled binary form, so any compiled binary already present in the script package is removed
(to avoid inconsistencies). However, as long as you do not change the AppleScript source code
the corresponding compiled binary remains untouched - also on Windows.
In summary, you can safely edit a multi-platform script package on Windows as long as you do
not touch the AppleScript source code (or in case you do not mind omitting the compiled binary).
Target applications in tell statements
Referring to Switch
In AppleScript, programs executed by PowerSwitch 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
140
Enfocus Switch 10