How to use a keyboard shortcut to run a script
Install the script you'd like to run into your scripts folder. Rename it as to be alphabetically towards the top of the Scripts list. For example 01-ScriptName.jsx should put it at the top of the list.
Navigate to the 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>
Note: Refer to this to find the Library folder on macOS
Open the "Adobe After Effects <version> Shortcuts" file in a text editor. Note that starting with CC the file is named: "Adobe After Effects <version> <language> Shortcuts.txt" so make sure to edit the correct one if you work in more than one language. To be safe, you may want to back up this file before modifying it.
Search for "ExecuteScriptMenuItem" and choose which script item you want and assign a shortcut to. Remember that they are in alphabetical order so the first script in the list will be ExecuteScriptMenuItem01, etc. When picking a keyboard shortcut, make sure to check for conflicts.
Attention Mac Users!
There is a potential bug on Mac where the first item is ExecuteScriptMenuItem02 (it's all shifted forward by one).
If you need to reset your shortcuts back to the defaults, you can delete or rename this file and relaunch After Effects.