How to Schedule Your Mac to Wake Up with AppleScript


Hi everybody,

After long time of asking me same question i finally found a smart guy that already did that with his Mac, i think it s very interesting because sometimes I’m in a hurry i have to turn on my Mac or something to read my work mail´s or maybe just read the newspaper (not the sports one).

So i ll attach you this beautiful manual of how you can do that script and turn on your mac every morning.

How to Schedule Your Mac to Wake Up with AppleScript

Posted  by Graham Miln

Modern Macs are able to wake up from sleep, and start up from a powered off state. One quick and easy use for this ability is to avoid waiting for your Mac to start up in the morning.

We are going to create an event using Power Manager and AppleScript. You can also create this event using just Power Manager’s System Preference; a previous recipe shows you how to schedule your Mac to power on without AppleScript.

How to Create a Wake Up Event in Power Manager

  1. Launch AppleScript EditorApplications > Utilities > AppleScript Editor.
  2. Copy and paste the following AppleScript into a new document:
    tell application "Power Manager Scripting"
    
    	tell workshop
    
    		set myEvent to make new event with properties {id:"myWakeEvent", name:"Wake up for work"}
    
    		-- Create a daily trigger
    		make new trigger daily at front of triggers of myEvent with properties {seconds from midnight:(8 * 60 * 60),availability:wake up, days: [Monday, Tuesday, Wednesday, Thursday, Friday]}
    
    	end tell
    
    	-- Deploy the event
    	tell Event Store to store these events myEvent
    
    	-- Clean up
    	tell the workshop to empty
    
    end tell

    Power Manager AppleScript in AppleScript Editor

    Power Manager AppleScript in AppleScript Editor

  3. Save the script: File > Save.
  4. Run the script: Script > Run.

When you run the above AppleScript, a new event is created in your schedule.

Wake up event in Power Manager after running the AppleScript

Wake up event in Power Manager after running the AppleScript

You can run the AppleScript as many times as you like; each time the event is created, the previous event is overwritten. This is because the new event and any previous event share the same identifier.

The above AppleScript contains three pieces of key information. These pieces are the trigger daily’s properties. The properties are the seconds from midnight to wake your Mac, the availability, and the days of the week to schedule the trigger.

You can alter these properties and change the behaviour of the event to better suit your needs.

The trigger daily’s properties are not limited to just these three values. Below is an extract from Power Manager’s AppleScript dictionary:

Power Manager’s trigger daily AppleScript item
trigger daily n [inh. trigger] : Trigger at a given time on given days of the week.Elements inherited from triggerContained by events, local workshops.

Properties

seconds from midnight
(integer) : Seconds past midnight to trigger.
The trigger’s time is measured in seconds from midnight. Where 0 seconds equals midnight.Calculate seconds from midnight using the following formula:

  • seconds from midnight = (hours x (60 x 60)) + (minutes x 60)
  • 5:30 am = (5 x (60 x 60)) + (30 x 60) = 19800 seconds from midnight
  • 2:23 pm = (14 x (60 x 60)) + (23 x 60) = 51780 seconds from midnight
days
(list of Saturday/Sunday/Monday/Tuesday/Wednesday/Thursday/Friday) : Days of the week to trigger.
availability
(wake up/power on/power on or wake up) : Should the host be made available for this trigger.
scatter
(integer) : Scatter the date.
quiet
(boolean) : Minimise the notifications.
drift
(integer) : Acceptable drift.

Part of the extensive Power Manager AppleScript dictionary

Part of the extensive Power Manager AppleScript dictionary

Thanks for follow my blog.

Vlad Precup

6 thoughts on “How to Schedule Your Mac to Wake Up with AppleScript

  1. Heya i am for the first time here. I came across this board and I find It truly helpful &
    it helped me out much. I’m hoping to provide something back and aid others such as you helped me.

    Like

  2. With havin so much content and articles do you ever run into any issues of plagorism or copyright infringement?
    My blog has a lot of exclusive content I’ve either created myself or outsourced but it looks like a lot of it is popping it up all over the web without my authorization. Do you know any methods to help stop content from being stolen? I’d really appreciate it.

    Like

    • Hi,

      I don´t have any protection for copyright and i really don t care if someone copies me, I do all this for hobby.

      Thanks for follow my blog,

      Vlad Precup

      Like

  3. It is really a nice and helpful piece of information. I’m satisfied that you just shared this helpful info with us. Please keep us informed like this. Thanks for sharing.

    Like

Thanks for following