Scripting the Scheduler

Sample AppleScripts for scripting Power Manager's Scheduler.

Start the Scheduler

Start the Scheduler queuing and performing events.

tell application "Power Manager"
    tell Scheduler to set enabled to true
end tell

Stop the Scheduler

Stop the Scheduler. Stops events being queued and performed.

tell application "Power Manager"
    tell Scheduler to set enabled to false
end tell

Toggle the Scheduler’s State

Toggle the Scheduler’s start/stop state:

tell application "Power Manager"
    tell Scheduler to set enabled to (not enabled)
end tell

Name of the Next Event

Get the name of the next Event to trigger.

tell application "Power Manager"
    tell Scheduler
        set myName to name of event of first queued trigger
    end tell
end tell

Actions of the Next Event

Get the action classes of the next event to trigger.

tell application "Power Manager"
    tell Scheduler
        set actionClasses to class of actions of event of first queued trigger
    end tell
end tell

Date and Time of the Next Trigger

Get the trigger date of the next event to trigger.

tell application "Power Manager"
    tell Scheduler
        set nextTriggerDate to date of trigger of first queued trigger
    end tell
end tell

Delay a pending trigger

Delay the next pending trigger by 5 minutes.

tell application "Power Manager"
    tell Scheduler
        
        -- Get the next trigger
        set myTrigger to first queued trigger
        set myDate to date of trigger of myTrigger
        
        -- Delay by 5 minutes
        adjust trigger with id (id of myTrigger) to date (myDate + 300)
        
    end tell
end tell

Cancel an Event

Cancels the next pending Event.

tell application "Power Manager"
    
    tell Scheduler to cancel trigger with id (id of first queued trigger)
    
end tell

Reset an Event

Reset the trigger of the next pending Event.

tell application "Power Manager"
    
    tell Scheduler to reset trigger with id (id of first queued trigger)
    
end tell