Power Manager > Help > AppleScript Guide > Sample Script - Weekday to Everyday Events

Sample Script - Weekday to Everyday Events

You have a schedule suitable to weekdays but you want to extend the daily tasks to everyday.

The script below makes every daily Event trigger on every day of the week.

Line  
1
tell application "Power Manager Scripting"
2
    
3
    tell scheduler
4
    	
5
    	-- Walk through all the daily events
6
    	repeat with thisEvent in (every PMEvent whose type class of trigger is daily)
7
    		
8
    		-- Copy the event properties
9
    		set myEvent to properties of thisEvent
10
    		set trigger of myEvent to properties of trigger of myEvent
11
    		set action of myEvent to properties of action of myEvent
12
    		
13
    		-- Modify the daily event
14
    		set days of trigger of myEvent to [monday, tuesday, wednesday, thursday, friday, saturday, sunday]
15
    		
16
    		-- Add the modified event (replaces the previous instance)
17
    		add event myEvent
18
    		
19
    	end repeat
20
    	
21
    end tell
22
    
23
end tell

Open in Script Editor