By default, when one or more use statements are added to a script, support for scripting additions must be manually enabled by adding another use statement concerning scripting additions:
use scripting additions
NOTE: use scripting additions has no specifier data and no additional parameters.
If a script has one or more use commands, scripting addition commands are handled differently in two ways.
First, scripting addition commands are not available by default. You must explicitly indicate when you wish to use scripting additions, either with a use or a using terms from command.
use scripting additions
display dialog "hello world"
using terms from scripting additions
display dialog "hello world"
end using terms from
Second, AppleScript may optimize scripting addition commands, sending them to the current application instead of the current target (it) when it does not change the meaning to do so.
For example, the scripting addition command: random number does not need to be sent to another application to work correctly, and will always be sent to the current application when imported in a use statement.
Without a use scripting additions command, AppleScript must use a less efficient dispatching scheme, so explicitly declaring them is recommended.