Just ran a quick test, and that should work just fine. If you look carefully in the script debugger, you should be able to see:
When you click the button, the debugger's call stack pane says something like
If you move one step along, the debugger should read:
and you should be able to see both the account name and the value (at least a zero should be here for the modifier keys, not an empty value)
and then the rest is up to you to get the parameter into script variables (which is fine BTW).
Now, I have done something to my own laptop which re-maps the right-side option key on my Mac laptop to be read as the 'Enter' key. When I hold that key down and click, I do get a zero (expected), but at least I get a value. Unless you remapped your keyboard (or are using an external keyboard that is somehow not actually connected to the machine (low-battery?), this should work.
By the way, I have a programming habit where I use a single
Set Variable ( $ScriptParameter ; Get ( ScriptParameter ) )
near the top of every script. I then base all relevant script variables off of $ScriptParameter. It's easier to type, easier to debug, and allows me to hang on to the original script parameter regardless of what crazy ideas I come up with for subsequent variables.
-- Drew Tenenholz
There is no need to send ActiveModifierKeys as part of the script parameter - you can get it directly inside the script. However, it still should work. Does the attached test file work for you?
ModifierTest.fp7.zip 6.2 K
1 of 1 people found this helpful
Found the issue.
It appears that if the script debugger is open, the result is always 0.
If it is closed, it then works as expected. I never did run the script without those close which is why i was never able to get a result other than 0.
Maybe this is just a silly timing issue.
I always get 0 when:
I hold down a key; I click the button; I let go of the key; I start stepping through the debugger.
I get a value when:
I hold down a key; I click the button; ; I start stepping through the debugger; I let go of the key.
Effectively, the value for Get(ActiveModifierKeys) is captured as the call stack moves from the button to the script, NOT when the button is clicked.
It appears that if the script debugger and/or the data viewer is open, the result is always 0.
That's not what I see. But you must hold the modifier keys when you click 'Run' in the debugger.
After further testing you are correct, i wasnt holding the key down when i clicked run in debugger.
Thanks for the help guys!.