Controlling PowerKey with AppleScript
AppleScript offers Mac users a powerful way to automate tasks and share information. PowerKey is fully scriptable, allowing your scripts to control your outlets.
To control PowerKey, place a tell block in your script as follows:
Mac OS X
Mac OS 8.6-9.x
You can then place PowerKey scripting commands inside this block.
The PowerKey software defines several classes of objects for use by AppleScripts. A unit is a single PowerKey Pro containing several outlet elements. An event is a hot key, tone sequence or scheduled event defined in the corresponding panel of the PowerKey control panel.
You access the properties of units, outlets and events using the AppleScript get and set commands.
-- Find out the name of an outlet.
For more information on PowerKey classes, use the "Open Dictionary" command in the Script Editor's File menu. In OS 8.6 or 9.x, open the "PowerKey Extension" (not control panel) in your system's Extensions folder. In OS X, select "PowerKey Daemon" (not just "PowerKey") in the list of applications.
To switch an outlet, you set its level property to 0 (off) or 100 (on). You can also get the level of an outlet to find out if it's currently on or off.
Note: You must specify both the outlet and the unit, even if you only have one PowerKey Pro. Units and outlets can be specified by name or number. Outlet numbers are fixed, but unit numbers can change every time the computer starts up, so it is best to refer to units by name.
-- turn on a numbered outlet.
Disabling and enabling events
Scripts can disable events to keep them from running, and re-enable them. To do this, set the enabled property of a unit's event to true or false. This is equivalent to unchecking the event's "On" box in the PowerKey control panel.
-- Don't let an event run.
Scripts can execute an Event's action immediately using the execute command.
-- Run an event immediately.
Table of contents