Action to toggle between Standard function keys and Mac standard features

I did it on my own:

  1. First, I run "Set Function Key Mode / Media Key Mode"
  2. Then I run the following Apple Script:
set functionKeyMode to do shell script "ioreg -n IOHIDSystem | sed -n 's/.*\"HIDFKeyMode\"=\\([0-9]*\\).*/\\1/p'"

if functionKeyMode is "1" then
    set modeText to "F1-F12"
else
    set modeText to "Media"
end if

tell application "BetterTouchTool"
    set_persistent_string_variable "BTTFunctionKeyMode" to modeText
end tell
  1. Output the HUD overlay with the variable {BTTFunctionKeyMode}