How to Start Up Your Mac Using AppleScript

You can schedule your Mac to automatically start up using Power Manager and AppleScript. Using AppleScript to create start up events opens up new possibilities for crafting complex and dynamic power management schedules.

You can schedule your Mac to automatically start up using Power Manager and AppleScript. Using AppleScript to create start up events opens up new possibilities for crafting complex and dynamic power management schedules.

This recipe shows how to create a start up event in Power Manager using AppleScript.

Power Manager supports AppleScript and provides start up capable triggers that can be used within your scripts.

There are two core triggers that can start up your Mac. The once trigger provides a one time trigger. The daily trigger provides a repeating trigger.

Start Up in 10 Minutes

The following AppleScript subroutine schedule_startup uses the once trigger to create a one off start up at a given date. In this example, the subroutine is asked to schedule a start up in ten minutes from now:

  1. Launch AppleScript Editor.app: Applications > Utilities > AppleScript Editor.

  2. Copy and paste the following AppleScript into a new document:

    -- schedule a start up event 10 minutes from now
    schedule_startup(((current date) + (60 * 10)), "Start Up in 10 Minutes")
    
    -- subroutine taking a date and string
    on schedule_startup(startup_date, unique_id)
    
        tell application "Power Manager Scripting"
    
            tell workshop
    
                set myEvent to make new event with properties {trigger ID:unique_id, name:unique_id}
    
                -- Create a once trigger in ten minutes from now to perform the actions
                make new trigger once at front of triggers of myEvent with properties {date:startup_date, availability:power on}
    
            end tell
    
            -- Deploy the event
            tell Event Store to store these events myEvent
    
            -- Clean up
            tell the workshop to empty
    
        end tell
    
    end schedule_startup
    

AppleScript to create a one time start up trigger AppleScript to create a one time start up trigger

  1. Save the script: File > Save.

  2. Run the script: Script > Run.

The AppleScript makes use of the once trigger’s availability support. Availability tells Power Manager to ensure the Mac is powered on and ready to perform the trigger at the scheduled time.

Power Manager showing the one off start up event Power Manager showing the one off start up event

This subroutine can be reused in your AppleScripts. You can call the schedule_startup subroutine as many times as needed.

Start Up Every Day

The following AppleScript subroutine schedule_startup_daily uses the daily trigger to create a repeating start up. In this example, the subroutine is asked to schedule a repeating start up every day at 11am:

  1. Launch AppleScript Editor.app: Applications > Utilities > AppleScript Editor.

  2. Copy and paste the following AppleScript into a new document:

    -- schedule a start up event at 11:00 every day
    schedule_startup_daily((60 * 60 * 11), "Start up daily at 11:00")
    
    -- subroutine taking an integer and string
    on schedule_startup_daily(seconds_from_midnight, unique_id)
    
        tell application "Power Manager Scripting"
    
            tell workshop
    
                set myEvent to make new event with properties {trigger ID:unique_id, name:unique_id}
    
                -- Create a daily trigger 
                make new trigger daily at front of triggers of myEvent with properties {seconds from midnight:seconds_from_midnight, days:[Monday, Tuesday, Wednesday, Thursday, Friday], availability:power on}
    
            end tell
    
            -- Deploy the event
            tell Event Store to store these events myEvent
    
            -- Clean up
            tell the workshop to empty
    
        end tell
    
    end schedule_startup_daily
    

AppleScript to start up a Mac once a day

AppleScript to start up a Mac once a day

  1. Save the script: File > Save.

  2. Run the script: Script > Run.

Power Manager showing the daily start up trigger

Power Manager showing the daily start up trigger

This subroutine can be reused in your AppleScripts. You can call schedule_startup_daily multiple times each with a different time of day and unique identifier.