Friday, 20 September 2013

AppleScript: Shut Down or Restart Your MacBook

The following script allows you to shut down or restart your MacBook with a simple click. You can also use the script with any MacBook management software (eg. Casper) to remind your users to shut down or restart their machine.

<<AppleScript>>

set question to display dialog "The machine has not been shut down or restarted for more than a week. Please shut down or restart the machine by clicking on Shut Down or Restart." with title "System Event by Andres Cheah, MCM" with icon stop buttons {"Shut Down", "Restart", "Cancel"}
set answer to button returned of question
if answer is equal to "Shut Down" then
tell application "System Events"
shut down
end tell
end if
if answer is equal to "Restart" then
tell application "System Events"
restart
end tell
end if
if answer is equal to "Cancel" then
return
end if

No comments:

Post a Comment