Is there any way to determine the hotkey that invoked the script within the script itself? I'd like to use that as a parameter for the script so that I don't have to write multiple versions of the following script, which lets you choose Terminal.app tabs using CMD+#.
tell application "Terminal" to set selected of tab 1 of front window to true
Hi yood - unfortunately there is no such conveyance of this information. Sounds like a good idea for a future enhancement, though.
One trick you might be able to get away with is to check for which keys are currently pressed. FastScripts usually runs a script so fast, that the keys are still beind held when the script starts running.
Here's a trick that could come in handy: create hard links of the original script. Hard linking effectively creates another disk entry for the same file. The links don't take up any extra space, and if you edit one, the changes are reflected in all the others … because they're the same file. Possibly a bit weird if you've never encountered them before :)
To hard link a file, go to the relevant directory in the terminal and type:
ln originalfilename newfilename
So you might have several files in the one folder called "1.applescript", "2.applescript" and so on.
When a script is run, it can then figure out what its name is (here's one technique for Applescript; in Bash and zsh the current script is in the special variable $0). Now you can use conditional logic in the script to vary behaviour depending on what its name is.
Not exactly what you were after, but hopefully there's something helpful here.
Ummmm … no idea. I had a quick Google for a solution but nothing leapt out, which was a little surprising as I thought it would be a fairly common question.