1

I want to make an applescript that taps the apple in the corner, taps shut down, and then taps shut down. I can't record it, since it actually involves shutting down the computer, making the script not being saved.

1
  • I've updated my answer with a click menu item example if you still want that. Jun 17 '15 at 22:07
2

You can use the following in an AppleScript to shutdown the system:

tell application "System Events" to shut down

If you really want to click the menu items you can go straight to clicking the "Shut Down" button with the following:

tell application "System Events" to click menu item "Shut Down" of menu 1 ¬
    of menu bar item "Apple" of menu bar 1 of process "Finder"

Note: I've add the ¬ Line-Continuation Symbol to keep from having to horizontally scroll to see the entire line, just remove it and place it all on one line in the script if you want. If you want to actually bring up the Shut Down message change "Shut Down" to "Shut Down…".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .