Friday, May 15, 2009

Unscripted Friday: Hot Corner Toggle Off (Applescript)

File: togglehotcornersoff.scpt
Language: Applescript
Download: http://gist.github.com/111949

-- Hot Screen Off Toggler: Toggle all four hot corners off. This is the counterpart to the script that toggles all four hot corners on, for cases when a visitor comes over who isn't used to active screen corners.
-- 2009 May 14. Written for OS X 10.5.x.
-- Gordon Mei, with guidance from Pierre L. from Apple discussions
-- Feel free to use and distribute however you'd like.

tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
tell menu bar 1
tell menu bar item "View"
delay 0.5
tell menu 1
click menu item "Exposé & Spaces"
end tell
end tell
end tell
tell window "Exposé & Spaces"
tell tab group 1
click radio button "Exposé"
tell group "Active Screen Corners"
tell pop up button 1 -- top left corner
click
tell menu 1
click menu item "-"
end tell
end tell
delay 0.05 -- delay here to prevent error: "can't get menu 1 of pop up button 2 of group...invalid index"
tell pop up button 2 -- bottom left corner
click
tell menu 1
click menu item "-"
end tell
end tell
delay 0.05
tell pop up button 3 -- top right corner
click
tell menu 1
click menu item "-"
end tell
end tell
delay 0.05
tell pop up button 4 -- bottom right corner
click
tell menu 1
click menu item "-"
end tell
end tell

end tell
end tell
end tell
end tell
delay 0.1
keystroke "w" using command down
end tell

No comments: