Sorry for the delay in response - so I’m not sure this will answer your question… but I was perusing the Built-In Macro Functions page and found this guy:
Returns true if the specified key is pressed, where key must be “shift”, “alt” or “space”. See also: setKeyDown.
Perhaps you can use this function with an if statement or so within your code? Hope this helps a little in any case…