Hi @dublove no I don’t think it will work the way you want because we don’t have good access to the keyboard via the scripting API, and none for the keyboard history, eg. what keys did you use to launch the script.
You seem to like the idea of “run one script but depending on something, get two different scripts”. This is really almost always unnecessary.
The normal way to do it is (a) put all your shared logic in a “//@include” file and (b) create TWO scripts which are the “entry points” to your main logic. Then you can assign shortcuts to those two scripts and you achieve your aim. If that doesn’t work in your case, would you mind explaining exactly why not?