Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
as_create_action_steps [2009/05/11 17:17]
scchang
as_create_action_steps [2014/05/28 16:15] (current)
Line 1: Line 1:
 +====== How to create action steps in AppleScript ======
 +
 +The following AppleScript code snippit illustrates how to make action steps using AppleScript.
 +
 +<​code>​tell application "​IndigoServer"​
 + set actionGroupName to "New Action Group from AppleScript"​
 + -- First, we create a new action group. It could also be a trigger action or time date action
 + make new action group with properties {name:​actionGroupName}
 +
 + -- Because Action Groups, Trigger Actions, and Time Date Actions can all have multiple
 + -- Action Steps, the AppleScript terminology to address each step is a bit
 + -- strange. Think of it as an array of action steps.
 + --
 + -- If you create a time date action or a trigger action, one empty action step created ​
 + -- automatically,​ so you'll want to set that one up first. However, if you're creating an
 + -- Action Group, you have to create the first step yourself. In this example, we'll have it 
 + -- toggle the state of a light.
 + --
 + -- This step is necessary because it's an Action Group and they don't have
 + -- a step created when they are created.
 + make new action step of action group actionGroupName
 + -- The rest of these steps are common regardless of which type you create
 + set action type of action step 1 of action group actionGroupName to controlLightOrAppliance
 + set device name of action step 1 of action group actionGroupName to "​Office Lamp"
 + set device action of action step 1 of action group actionGroupName to toggleDevice
 +
 + -- Create another action step, which is synonymous with clicking the 
 + -- "Add New" button on any Actions or Action Group definition tab. Here,
 + -- we'll pass in a list of properties so we can do it all in one statement.
 + -- And, for this step, we'll have it set a variable.
 + make new action step of action group actionGroupName with properties ¬
 + {action type:​modifyVariable,​ variable action:​setValue, ​ ¬
 + variable name:"​tempVar",​ variable value:"​variable value here"}
 +end tell</​code>​
 +
  
as_create_action_steps.txt · Last modified: 2014/05/28 16:15 (external edit)
 

© Perceptive Automation, LLC. · Privacy