can an applescript be triggered by pressing an assigned hot key?
Not by AppleScript alone except in rather inefficient ways. QuicKeys X, Keyboard Maestro and a host of applications allow you to assign keys for a lot of things including starting a Script.app. QK is expensive, however.
In my experience, none of the keyboard shortcut apps handle scripts, specifically, as well as my utility, FastScripts.
Almost all of them allow script execution by keyboard shortcut, but most of them suffer from one or more of the following problems:
- SLOW response time
- Changes the application focus when running the script
- Can’t assign a shortcut specific to an application
- Requires lengthy setup or manual re-typing of script code into app
FastScripts was designed to avoid all of those problems and also has a lot of other nice features that make it (in my ever so hiumble opinion) the best “keyboard shortcuts for script nerds” utility.
xkeys is good also: