This is still a work in progress but I think it should work with os Catalina and Big Sur
on alfred_script(q)
set theCheckboxBoolean to false
set checkboxcompare to "Use F1, F2, etc."
set i to 0
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell process "System Preferences"
tell window "Keyboard"
set listCheckboxes to (entire contents as list)
repeat with thisItem in listCheckboxes
if class of thisItem is checkbox then
set checkboxtitle to title of thisItem as text
if checkboxtitle contains checkboxcompare then
set theCheckbox to thisItem
tell theCheckbox
click theCheckbox
log (its value as boolean)
set theCheckboxBoolean to (its value as boolean)
end tell
exit repeat
end if
end if
set i to i + 1
delay 0.04
end repeat
end tell
end tell
end tell
quit application "System Preferences"
return theCheckboxBoolean
end alfred_script
Toggle Fn keys as standard keys
in Share your Workflows
Posted
This is still a work in progress but I think it should work with os Catalina and Big Sur
on alfred_script(q) set theCheckboxBoolean to false set checkboxcompare to "Use F1, F2, etc." set i to 0 tell application "System Preferences" reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" end tell tell application "System Events" tell process "System Preferences" tell window "Keyboard" set listCheckboxes to (entire contents as list) repeat with thisItem in listCheckboxes if class of thisItem is checkbox then set checkboxtitle to title of thisItem as text if checkboxtitle contains checkboxcompare then set theCheckbox to thisItem tell theCheckbox click theCheckbox log (its value as boolean) set theCheckboxBoolean to (its value as boolean) end tell exit repeat end if end if set i to i + 1 delay 0.04 end repeat end tell end tell end tell quit application "System Preferences" return theCheckboxBoolean end alfred_script