-
Notifications
You must be signed in to change notification settings - Fork 24
/
restart.applescript
47 lines (47 loc) · 1.62 KB
/
restart.applescript
1
-- MAKE SURE SUPPORT FOR ASSISTIVE DEVICES IS ACTIVEtell application "System Events" if UI elements enabled is false then tell application "System Preferences" activate set current pane to pane id "com.apple.preference.universalaccess" display dialog "This script requires access for assistive evices be enabled." & return & return & "To continue, click the OK button and enter an administrative password in the forthcoming security dialog." with icon 1 end tell set UI elements enabled to true if UI elements enabled is false then return "user cancelled" delay 1 end ifend tell-- SWITCH TO THE DESIRED PANEtell application "System Preferences" activate set current pane to pane id "com.apple.preference.startupdisk" tell application "System Events" tell process "System Preferences" -- UNLOCK CHECKS if (exists checkbox "Click the lock to make changes." of window 1) is true then click checkbox "Click the lock to make changes." of window 1 -- wait for security login or dismissal repeat until (count of every window) is not 0 delay 1 end repeat if (exists checkbox "Click the lock to make changes." of window 1) then set perform_changes to false else set perform_changes to true end if else set perform_changes to true end if if perform_changes is true then -- MAKE CHANGES tell radio group 1 of scroll area 1 of group 1 of splitter group 1 of window 1 click button drive_identifier end tell delay 1 click button "Restart…" of window 1 delay 1 click button "Restart" of sheet 1 of window 1 end if end tell end tellend tell