User Tools

Site Tools


dictionary:events:createevent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dictionary:events:createevent [2021/02/15 13:23] – added parameter example James Sentmandictionary:events:createevent [2023/02/13 14:52] (current) – external edit 127.0.0.1
Line 3: Line 3:
  
 ===Usage:=== ===Usage:===
-**create event** (event name, or blank and XTension will create one for you)\\ +  * **create event** (event name, or blank and XTension will create one for you)\\ 
-**that** (command: turnson/turnsoff/toggles/executes/dims/presets/blocks/unblocks)\\ +  **that** (command: turnson/turnsoff/toggles/executes/dims/presets/blocks/unblocks)\\ 
-**unit|script** (name of the unit or the script to act upon)\\+  **unit|script** (name of the unit or the script to act upon)\\
  
 ===Optional Parameters:=== ===Optional Parameters:===
-**to level** (integer, the value for the chosen command)\\ +  * **to level** (integer, the value for the chosen command)\\ 
-**in** (seconds till the start time)\\ +  **in** (seconds till the start time)\\ 
-**starts at** (AppleScript date at which to start the event)\\ +  **starts at** (AppleScript date at which to start the event)\\ 
-**repeats every** (integer value in seconds)\\ +  **repeats every** (integer value in seconds)\\ 
-**randomize by** (integer, minutes by which to randomize the repeat interval)\\ +  **randomize by** (integer, minutes by which to randomize the repeat interval)\\ 
-**with no script** (perform the action, but dont run the unit scripts)\\ +  **with no script** (perform the action, but dont run the unit scripts)\\ 
-**weekdays** (7 character string in the form of "-MTWTF-" use dashes for days not to execute)\\ +  **weekdays** (7 character string in the form of "-MTWTF-" use dashes for days not to execute)\\ 
-**handler** (string, name of the handler) If executing a script you can optionally specify the handler to call rather than just running the script. This value is ignored unless the event is to execute a script. +  **handler** (string, name of the handler) If executing a script you can optionally specify the handler to call rather than just running the script. This value is ignored unless the event is to execute a script.\\ 
-**parameter** A list of items to be optionally passed to the handler. Only valid if you are executing a handler in the script. The number of parameters in the list must be the same as expected by the handler.+  **parameter** A list of items to be optionally passed to the handler. Only valid if you are executing a handler in the script. The number of parameters in the list must be the same as expected by the handler.
  
 ===Examples:=== ===Examples:===
Line 32: Line 32:
  
 ==Passing Parameters To A Handler Example== ==Passing Parameters To A Handler Example==
-if you had a global script named “global test script” with a handler named “doThing” like this:+if you had a global script named “meal manager” with a handler named “mealLogger” like this:
 <code> <code>
-on doThing( theName, theEvent) +on mealLogger( theName, theEvent) 
-    write log theName & “ has “ & theEvent+    write log theName & “ has had “ & theMeal
 end doThing end doThing
 </code> </code>
  
-and created an event such as this:+and then created an event such as this: 
 <code> <code>
-create event “do thing test” that executes script “global test script” handler “doThing parameter {“Jamie”, “Breakfast”} in 10 * minutes+create event “breakfast” that executes script “meal manager” handler “mealLogger" parameter {“Jamie”, “Breakfast”} in 10 * minutes
 </code> </code>
  
 in 10 minutes you would see output in the log like: in 10 minutes you would see output in the log like:
  
-jamie has breakfast+jamie has had breakfast
  
  
 ===History:=== ===History:===
 The optional “handler” parameter was added in XTension 9.4.21 The optional “handler” parameter was added in XTension 9.4.21
dictionary/events/createevent.1613395396.txt.gz · Last modified: 2023/02/13 14:51 (external edit)