Adobe After Effects has a keyboard shortcut file which allows us to modify or add our own shortcut keys. To run scripts with keyboard shortcuts, you need to define the keys but before that install the script you’d like to run into your scripts folder (Adobe After Effects <version>/ Support Files/ Scripts).
Rename the script file to be alphabetically towards the top of the scripts list. For example 01-Script.jsx should put the script at the top of the list.
Now, navigate to After Effects Preferences folder:
Windows – <drive>\Users\<username>\AppData\Roaming\Adobe\After Effects\<version>
Mac OS – <drive>/Users/<username>/Library/Preferences/Adobe/After Effects/<version>
In After Effects Preference Folder, open the “Adobe After Effects <version> Shortcuts” file in a text editor. To be on the safer side, backup the file before modifying it.
Open the shortcuts.txt file and search for “ExecuteScriptMenuItem” and choose which script item you want to run and assign a shortcut to it. Since they are in alphabetical order, the first script in the list will be ExecuteScriptMenuItem01, second will be ExecuteScriptMenuItem02 and so on. Make sure to check for conflicts before assigning a shortcut keys combination.
If you want to reset your shortcuts back to the defaults, Delete or Rename the file and relaunch After Effects.
Note for MAC Users
There is a bug on Mac where the first item is ExecuteScriptMenuItem02 (it’s all shifted forward by one).