Function Keys Swap

Has anyone successfully written a shortcut which will turn on/off the setting in Tahoe for “Use F1, F2, etc. keys as standard function keys?

Since I am new to trying to use shortcuts, I asked ChatGPT, and it gave me several options, none of which worked, so I thought I would ask the experts.

Thanks!