Created
September 1, 2017 12:38
-
-
Save mozillalives/32e90afbe962e01835947d01e7fcfc73 to your computer and use it in GitHub Desktop.
Just a simple applescript I wrote years ago to toggle hot corners on or off. Useful when you're about to play a game and don't want to suddenly have your display go to sleep XD
This file contains hidden or 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
property theSavedValues : {"Put Display to Sleep", "Desktop", "Mission Control", "Application Windows"} | |
# or this can be something like | |
# property theSavedValues : {"Put Display to Sleep", "-", "-", "-"} | |
tell application "System Preferences" | |
activate | |
set current pane to pane id "com.apple.preference.expose" | |
tell application "System Events" | |
delay 1 # you might need to tweak this for your system | |
tell window "Mission Control" of process "System Preferences" | |
click button "Hot Corners…" | |
tell sheet 1 | |
tell group 1 | |
set theCurrentValues to value of pop up buttons | |
if theCurrentValues is {"-", "-", "-", "-"} then | |
repeat with i from 1 to 4 | |
set thisValue to item i of theSavedValues | |
tell pop up button i | |
click | |
click menu item thisValue of menu 1 | |
end tell | |
end repeat | |
else | |
copy theCurrentValues to theSavedValues | |
repeat with i from 1 to 4 | |
tell pop up button i | |
click | |
click last menu item of menu 1 | |
end tell | |
end repeat | |
end if | |
end tell | |
click button "OK" | |
end tell | |
end tell | |
end tell | |
quit | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two important notes. First, you'll want to save this as an Application so you can just double click to run it. Second, when you first run this you'll need to grant it assistive access permission.