property safe_sleep : "Enter Normal sleep mode first (3)" tell application "Finder" set safe_sleep_hard_pref to do shell script "pmset -g | grep hibernatemode | awk '{print $2}'" as string if safe_sleep is "Enter Normal sleep mode first (3)" then set safe_sleep to "Hibernate straight away (1)(Skip Normal sleep)" set safe_sleep_SKIP_regular_sleep_1 to do shell script "pmset force -a hibernatemode 1" else if safe_sleep is "Hibernate straight away (1)(Skip Normal sleep)" then set safe_sleep_Regular_sleep_first_3 to do shell script "pmset force -a hibernatemode 3" tell application "System Preferences" activate set current pane to pane "com.apple.preference.energysaver" tell application "System Events" tell application process "System Preferences" click checkbox "Put the hard disk(s) to sleep when possible" of tab group 1 of window "Energy Saver" click checkbox "Put the hard disk(s) to sleep when possible" of tab group 1 of window "Energy Saver" ignoring application responses tell application "System Preferences" to quit end ignoring end tell end tell end tell set safe_sleep to "Enter Normal sleep mode first (3)" end if end tell tell application "Finder" activate display dialog "System hibernatemode is :" & safe_sleep_hard_pref & return & return & ¬ " hibernatemode is on " & safe_sleep buttons {"OK"} default button 1 end tell