Created
February 8, 2017 20:26
-
-
Save leftyfl1p/11ded025539c31db0f30518e1456c2e5 to your computer and use it in GitHub Desktop.
AppleScript to enable Function/F-Keys on Mac while a League of Legends game is open
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
repeat | |
tell application "System Events" | |
delay 1.0 | |
set frontmostProcessName to item 1 of (get name of processes whose frontmost is true) | |
if frontmostProcessName = "LeagueofLegends" then | |
tell application "System Preferences" | |
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" | |
end tell | |
tell application "System Events" to tell process "System Preferences" | |
set theCheckbox to checkbox 1 of tab group 1 of window 1 | |
tell theCheckbox | |
set checkboxStatus to value of theCheckbox as boolean | |
if checkboxStatus is false then | |
click theCheckbox | |
log "check box is off, setting it on" | |
end if | |
end tell | |
end tell | |
else | |
tell application "System Preferences" | |
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" | |
end tell | |
tell application "System Events" to tell process "System Preferences" | |
set theCheckbox to checkbox 1 of tab group 1 of window 1 | |
tell theCheckbox | |
set checkboxStatus to value of theCheckbox as boolean | |
if checkboxStatus is true then | |
click theCheckbox | |
log "check box is on, setting it off" | |
end if | |
end tell | |
end tell | |
end if | |
end tell | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment