Script to change System Preference function key settings no longer working in Big Sur OS11
This AppleScript code works for me on Big Sur.
tell application &quot;System Preferences&quot;
    reveal anchor &quot;keyboardTab&quot; of pane &quot;com.apple.preference.keyboard&quot;
end tell
tell application &quot;System Events&quot;
    tell process &quot;System Preferences&quot;
        repeat until checkbox &quot;Use F1, F2, etc. keys as standard function keys on external keyboards&quot; of tab group 1 of window &quot;Keyboard&quot; exists
            delay 0.1
        end repeat
        click checkbox &quot;Use F1, F2, etc. keys as standard function keys on external keyboards&quot; of tab group 1 of window &quot;Keyboard&quot;
    end tell
end tell
quit application &quot;System Preferences&quot;

If that version throws errors… here is an alternate version that also works for me.
tell application &quot;System Preferences&quot;
    reveal anchor &quot;keyboardTab&quot; of pane &quot;com.apple.preference.keyboard&quot;
end tell
tell application &quot;System Events&quot; to tell process &quot;System Preferences&quot;
    repeat until checkbox 3 of tab group 1 of window &quot;Keyboard&quot; exists
        delay 0.1
    end repeat
    click checkbox 3 of tab group 1 of window &quot;Keyboard&quot;
end tell
quit application &quot;System Preferences&quot;