Create new instance.
Optional
lastIf a function fails, this property will contain the last error as a string message, otherwise it will be undefined
.
Optional
lastIf a the AppleScript subroutine called returns a value and it can be converted to a JavaScript object, it will be stored here. Most basic data types (string, date, numbers), as well as list and records containing those data types, can be returned.
Compiles and executes the AppleScript code, calling the subroutine passed with the arguments.
The name of a subroutine in the AppleScript to call. Subroutines are defined using on subroutineName()
syntax in the AppleScript.
An array of arguments to pass to the subroutine. Most basic Javascript data types, and objects and arrays of those data types, can be passed and will be translated to the proper AppleScript types.
true
if the AppleScript was compiled and executed without error, false
if not. If false
, the lastError
property will contain details regarding the error.
Static
createConvenience method to create an AppleScript object.
A string containing the AppleScript code. This code will be compiled and executed when the execute
function is called.
AppleScript objects can be used to execute AppleScripts. It is highly recommended AppleScripts be developed and tested in Apple's Script Editor or similar AppleScript editor, and loaded in Drafts when completed.
Example
Note: When executed, AppleScripts are saved to temporary files in the Drafts' script directory at
~/Library/Application Scripts/com.agiletortoise.Drafts-OSX
and run. The first time a script is executed, the user will be asked to grant permissions to the script directory.