I have button that runs a script when clicked. Is it possible to set the same button to run a different script when clicked with a modifier key held down (shft-click, ctrl-click, opt-click etc)?
Thanks in advance
Check out the Get (ActiveModifierKeys) script step. Used in conjunction with an IF statement should allow you to branch off a script when a supported key is selected.
I think that could be problematic for a user, and for data integrity. I would either do 2 buttons, or when clicked, Show Custom Dialog and ask which script to run.
If you could tell us a little more about what you are trying to accomplish, maybe someone could offer a better solution
yes, start the script with
Set Variable [$modifiers; Get(ActiveModifierKeys)]
and branch on $modifiers following the values from here.
Don't forget to evaluate both for a key and the caps lock + that key.
Yes! I do this all the time. The first step script called will capture the key(s) used when the button is clicked:
Set Variable ( $amk = Get ( ActiveModifierKeys ) )
Then branch the script based on the value.
Remember that these are "additive", so clicking any key with the Caps Lock down will include that in the number to test. This is true with any combination of keys.
Shift + Caps Lock = 3
I like to add a tooltip to remind myself what the combos mean.
Thanks for all the answers. Get activemodifierkeys will do the trick just fine.
For your info, this is to control the zoom in a webviewer field, which presents a google static map. The calculated URL has a zoom field and I want the user to be able to zoom in by clicking on the map and zoom out by shift clicking. Easily done with activemodifierkeys.