How to add keyboard shortcut to toggle F1, F2, etc. as standard function keys

applescriptkeyboardsystem-prefs

I saw an AppleScript on Github to automate toggling F1, F2, etc. as standard function keys, but I don't know how to install it to my system and trigger it via a keyboard shortcut. Help?

I am running OS X Yosemite 10.10.1. Here's the script: https://gist.github.com/alampros/2b81af6cfc564f6accd3

Best Answer

In order to assign a keyboard shortcut to this script, you could create a service in Automator.

enter image description here

You must change Service receivesto no input. Then add Execute AppleScript and paste your script. Save it on ~/Library/Services.

enter image description here

Once saved, you must go to System Preferences → Keyboard → Shortcuts and you can find out under Services → General. Assign your preferred shortcut there.