User Tools

Site Tools


Sidebar

dictionary:events:executescript

Execute Script

This verb allows any script to execute any Global Script by name.

Usage:

execute script (name of a global script)

Optional Parameters:

in (integer, creates a scheduled event that executes the script in this many seconds)
at (date, like the “in” parameter but takes an applescript date object at which time you’d like the script to run)
handler (text, the name of a handler in the script that you would like to run instead of the script as a whole)
parameters (list, if the handler specified requires parameters you can send them as a list of any applescript objects or values here)

Examples:

execute a script in 4 minutes

execute script “myScriptName” in 4 * minutes

execute a script a 4pm today

execute script “myScriptName” at date (“4:00pm”)

execute a handler in the script called “doSomethingClever” at 10pm tonight

execute script “myScriptName” handler “doSomethingClever” at date (“10:00pm”)

this would execute a handler in the global scrip that looked something like this:

on doSomethingClever()
  write log “I am doing something clever”
end doSomethingClever

pass some parameters to a handler to be run in 2 hours

execute script “myScriptName” handler “doSomethingClever” parameters {“param1”, “param2”, “param3”} in 2 * hours

this would execute a script and pass the parameter specified something like this:

on doSomethingClever( firstData, secondData, thirdData)
  write log “I was passed data “ & firstData & “ and “ & secondData & “ and “ & thirdData
end doSomethingClever
dictionary/events/executescript.txt · Last modified: 2016/03/14 00:43 (external edit)