Created
July 21, 2017 15:21
-
-
Save daxeh/8945f55b8cf94d23a5f7bb2beeda81bd to your computer and use it in GitHub Desktop.
OSX Automator Applescript prevent computer from sleeping. Simplified interaction with auto-dismiss prompt and notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
set clickedValue to "Continue" | |
repeat while clickedValue is not "Don't Continue" | |
display notification "Executing command 'caffeinate -t 9600' " with title "Awake Notification" subtitle "Caffeinate started." | |
if (do shell script "caffeinate -t 9600") is "" then | |
set theDialogText to "Awake duration ended. Would you like to continue?" | |
set theDialog to display dialog theDialogText giving up after 5 buttons {"Don't Continue", "Continue"} default button "Continue" | |
set clickedValue to button returned of theDialog | |
end if | |
end repeat | |
display notification with title "Awake Notification" subtitle "Caffeinate ended." sound name "Frog" | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment