Run AppleScript code, [errorVariable] v1.2
Runs the given AppleScript code and returns the last value generated by the AppleScript.
If an error occurs (eg: an AppleScript compilation error) then this command returns the @undefined value. If the optional error variable was provided, then the contents of that variable are replaced with the error message as reported by AppleScript.
An example that has the user select a folder:
$code = '
tell application "Nisus Writer Pro"
choose folder
end tell
POSIX path of the result'
$error = ""
$result = Run AppleScript $code, $error
If Defined $result
Prompt "The chosen folder is: $result"
Else
Prompt "An AppleScript error occurred.", $error
End
Starting with v2.1 the macOS Sandbox prevents Nisus Writer from using AppleScript to communicate with other applications.
Previous Chapter Numeric Commands |
<< index >> |
Next Chapter UI Interactions |