This is a legacy guide for Power Manager v3, published 2005 – 2010, and is provided for reference only.
The latest guide is for Power Manager v5.10.4.

Scripting the Events

Counting Events

Get the number of Events.

tell application "Power Manager Scripting"
    tell scheduler
    	set numEvents to count PMEvents
    end tell
end tell

Counting Daily Events

Get the number of Events with Daily triggers.

tell application "Power Manager Scripting"
    tell scheduler
    	set numEvents to count (PMEvents whose type class of trigger is daily)
    end tell
end tell

Looking for Existing Events

Say ‘Morning exists.’ if an Event called “Morning” exists.

tell application "Power Manager Scripting"
    tell scheduler
    	if exists (PMEvent "Morning") then
    		say "Morning exists."
    	end if
    end tell
end tell

Add an Event

Creates a new Start Up or Wake Event triggered Once in an hour.

tell application "Power Manager Scripting"
    tell scheduler
    	add event {enabled:true, unique id:"in-one-hour", name:"Wake up in one hour!", trigger:{type class:once, date:((current date) + (60 * 60))}, action:{type class:start up or wake}}
    end tell
end tell

Copy an Event

Finds an Event by name, copies its properties, and adds a new Event with a slightly different name.

tell application "Power Manager Scripting"
    tell scheduler
    	-- Copy the Event "Morning"
    	set myEvent to properties of PMEvent "Morning"
    	set trigger of myEvent to properties of trigger of myEvent
    	set action of myEvent to properties of action of myEvent
    	-- ...modify as needed
    	add event myEvent
    end tell
end tell

The add command needs a record of properties. The properties returned by properties of PMEvent “Morning” include references to other records - we need to resolve those references ourselves; thus the following two lines setting trigger and action.

Rename an Event

Finds an Event by name, modifies it name, and resubmits the updated copy.

tell application "Power Manager Scripting"
    tell scheduler
    	-- Copy the Event "Morning"
    	set myEvent to properties of PMEvent "Morning"
    	set trigger of myEvent to properties of trigger of myEvent
    	set action of myEvent to properties of action of myEvent
    	-- Rename our copy
    	set name of myEvent to "Second Dawn"
    	-- Resubmit the event
    	add event myEvent
    end tell
end tell

The copy, modify, and add works to modify the existing Event because we do not change the unique id.

Disable an Event

Finds an Event by name, disables it, and resubmits the updated copy.

tell application "Power Manager Scripting"
    tell scheduler
    	-- Copy the Event "Morning"
    	set myEvent to properties of PMEvent "Morning"
    	set trigger of myEvent to properties of trigger of myEvent
    	set action of myEvent to properties of action of myEvent
    	-- Disable our copy
    	set enabled of myEvent to false
    	-- Resubmit the event
    	add event myEvent
    end tell
end tell

Remove an Event by Name

Removes an Event by name.

tell application "Power Manager Scripting"
    tell scheduler
    	remove unique id (unique id of PMEvent "Morning") as string
    end tell
end tell

Remove all Events

Remove all Events from the schedule.

Fetches all the unique ids into a list and passes item of the list to the remove command.

tell application "Power Manager Scripting"
    tell scheduler
    	set everyID to unique id of every PMEvent
    	repeat with anID in everyID
    		remove unique id anID
    	end repeat
    end tell
end tell