Determining Mapped Key that Called Script?

Jerry-Malcolm wrote on 12/16/2024, 8:31 AM

This may be a long shot. But I have a script that is called from each number key (0-9). The script is identical for each call except for the key that called it. I simply need to know which key was pressed to invoke the script. Right now, I have 10 copies of the script with a line or two changed in each one, i.e. a '1-key' script, a 2-key script. This is hugely inefficient with a lot of overhead to manage 10 scripts. I know I can have a common class and 10 different 1-line script projects passing a '1', '2', '3'. Alternatively, is the calling mapped key passed anywhere or available anywhere from inside the script? Thx.

Comments

jetdv wrote on 12/16/2024, 9:04 AM

I don't think you can see what key called the script. I handled that in a different way - in Excalibur I have the single custom command that created many menu options and the menu option chosen determines what part of Excalibur runs. So then each keypress is associated with the particular menu option. But this option requires a "custom command".

If you want to keep them as simple scripts, you'll need to maintain the 10 different versions as you are now. If you want to create a custom command, you can actually call the 10 different scripts from that custom command or you could combine them all into the custom command.

Jerry-Malcolm wrote on 12/16/2024, 10:26 AM

Thanks, Ed. I was really suspecting that was the answer. I guess I shouldn't get too greedy... :-). But if you have any insides with the 'powers that be' inside Magix/Vegas... please drop this desire/requirement to them. Sure would be nice...

VEGASDerek wrote on 12/16/2024, 3:14 PM

jetdv's response is the proper way of handling this. Custom commands were created for these more compound type of workflows. Simple scripts, or one-and-done operations, are not currently designed to have this sort of detail passed around and we do not have any intention of making a change to provide data like that as we have a ton of other fish to fry right now in the application. Sorry we cannot help much more than that right now.