Selecting a scripting language

Switch supports three scripting languages (JavaScript, VBScript, AppleScript) as explained in the Scripting reference.

In general, use JavaScript unless there is a good reason to select an operating system scripting language (like VBScript or AppleScript). JavaScript scripts are cross-platform, that is, they work without change on both Mac OS X and Microsoft Windows, and most of the Switch scripting examples available on the web or from other users will be in JavaScript.

At the same time, JavaScript scripts have limited "external access". For example, there is no way to communicate with interactive applications and there is no access to operating system services. If these features are necessary, use AppleScript or VBScript. If required, build a cross-platform script package by including both an AppleScript and VBScript implementation.

If a script package contains more than one script program, Switch selects one of the programs for execution by looking for them in this order:


If neither of these are included, the script package cannot be executed.