applescript
SOURCE
,
RESULT
,
TIMEOUT

The applescript statement executes an AppleScript.


Parameters

This statement has three parameters:

source – source code of an AppleScript program. Note: It is very convenient to use “pipe” delimiters for the source code parameter, for example |||code|||. This eliminates needing to worry about the delimiters appearing in the source code itself.

result – the name of the field or variable in which the result of the script will be placed. The result is the result of the final line of the script. If this parameter is not supplied the result will be placed in the global variable, ScriptResult.

timeout – maximum amount of time the script will be allowed to run (in seconds). If this option is not specified you can set the default using the scripttimeout statement. If this default has never been set the default is 60 seconds.


Description

This statement executes an AppleScript. Here is a simple example that uses the Finder to get the name of all currently mounted disk drives.

local diskNames
applescript |||
tell application "Finder"
    return name of every disk
end tell
|||,diskNames
message diskNames

Panorama formulas can be embedded in the AppleScript source code using special tags. To embed a Panorama formula use

$«formula»$

The formulas are calculated in advance, then embedded into the source code as constants. For example, the formula $«2*3»$ will be embedded into the program as 6. The formula $«upper("hello world")»$ will be embedded as "HELLO WORLD".

In the case of text formulas, any special characters will be encoded as necessary for a proper AppleScript constant. For example the formula $«{"}»$ will be embedded as "\“".

To embed a Panorama formula with no quotes or translation, use this format

^«formula»^

Note: This statement is designed to replace the older executeapplescript and executeapplescriptformula statements (which are retained for compatibility with older databases). Note that the formula embedding format is different from the executeapplescriptformula statement.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.