Last active
December 18, 2015 05:29
-
-
Save astyagun/5732703 to your computer and use it in GitHub Desktop.
AppleScript StarCraft 2 launcher that enables Function keys before the game starts and disables them again after the game quits.
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
to enableFunctionKeys(functionKeys) | |
tell application "System Preferences" to activate | |
tell application "System Preferences" | |
activate | |
reveal pane id "com.apple.preference.keyboard" | |
tell application "System Events" | |
tell application "System Preferences" | |
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" | |
end tell | |
tell checkbox 1 of tab group 1 of window 1 of application process "System Preferences" | |
if (functionKeys and value is 0) or (not functionKeys and value is 1) then | |
click | |
end if | |
end tell | |
end tell | |
quit | |
end tell | |
end enableFunctionKeys | |
enableFunctionKeys(true) | |
tell application "StarCraft II" to activate | |
# Wait for StarCraft to quit | |
repeat | |
if application "StarCraft II" is not running and application "Blizzard Launcher" is not running and application "SC2" is not running then exit repeat | |
delay 5 | |
end repeat | |
enableFunctionKeys(false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment