This capability has been around since Lightroom 2 (or possibly earlier) and first came to public attention when it was used to resolve a bug with upgrading Lightroom 1 catalogs to Lightroom 2. We discussed it a little in this forum nearing 4 years ago so its no wonder you didn't spot that conversation..
I used it years ago to publish a small script for relaunching Lightroom with the current catalog.
If what you are doing can be done within a plugin then it is much better to use that approach. Scripts are unsupported, and not designed for Lightroom user use, so a thrown exception, endless loop, or long running synchronous task can cause havoc for Lightroom and when first using this technique I managed to lock up Lightroom quite a few times. You need to be very careful when using this undocumented capability.
Thanks Matt - I must've come on board just after that... .
One big difference I've found executing a plugin script via file menu, and executing a script via script menu - in the latter case:
LrBinding.makePropertyTable does not work. (The function-context is not recognized as being proper...). *** big bummer...
Can one associate a key combination to a script ?
I'd like Lr to give a ** rating and blue label if I press the numeric keypad '2'; whereas if I press '5' I'd like Lr to give a ** rating and red label. As I only use * or ** or ***, I could work around photographs faster.
Anyone know of a way to attach a script to a key combination ?
I use autohotkey on windows, to assign keystrokes to plugins (*not* scripts as defined in this thread, since such scripts are not accessible via keyboard - only via mouse) but there are other ways too...
On the changing key combination side, Lightroom does not give us an official way to change keyboard shortcuts for its features.
The Keyboard Tamer plugin can make some changes to keyboard shortcuts used in Lightroom. On Windows Rob has mentioned the way to assign keypresses to Lightroom features. On Mac there is a built in feature that can let you do roughly the same thing.
There are also some specialist keyboards you can purchase that can be programmed to run Lightroom commands (e.g. RPG Keys).
On the script side, don't use a script for this. It would be too dangerous. A plugin could set the metadata for you instead, expose menu items and use the techniques above to call the menu item.
Seems like a lot of work to save a keypress (per photo).