image

Opening a Compiled Script as Text

image

Sometimes, AppleScript prevents Script Debugger from opening a compiled script file, or shows the file’s contents with raw Apple event codes. This indicates that something has gone wrong with the decompilation process. For example, an application or scripting addition needed by the script is missing, or a script’s internal alias to an application has broken.

If the script was originally saved with Script Debugger, you can open the script as text. To do so:

This feature works because when Script Debugger saves a compiled script, it saves not only the compiled bytecode but also the uncompiled text. The uncompiled text is placed in the file’s resource fork (or, if the file is a bundle, in a file within the bundle).

Warning: If you edit a script with some other script editor application, the stored uncompiled text may no longer match the current state of the bytecode.

Open As Text Instead of Launching an Application

Script Debugger may automatically let you open a script as text, if you attempt to open a compiled script that targets an application which must be launched in order for AppleScript to decompile it.

For example, suppose AppleScript Editor is not running and you open a compiled script that targets AppleScript Editor. If AppleScript Editor isn’t already running, AppleScript wants to launch it in order to display the script. Script Debugger detects this and can optionally intervene:



image
Compatibility