I use a medical journal application on a daily basis. The F2 function key is used to affirm some, but unfortunately not all dialogue windows. For example in some cases I have to either manually clik "ok" button, or press an illogical key combination to dismiss the dialogue window.
Therefore I tried to make a script that uses F2 as a hotkey trigger, with some conditional behavior based on the active window name. This works ok as long as I don't need the F2 key to function as originally intended (for example the F2 key is used to duplicate a journal entry in the application).
I've tried to make a "passthrough", ie in cases where I just want a F2 press to send F2 to the application, but unsurprsingly this leads to an endless loop of script self-activation, since F2 is the hotkey for the script.
I then attempted to use the trigger function in macro scheduler, so that a specific window would start a script with this simple code (VK113 is the virtual key code for F2):
Code: Select all
//wait for F2 press
OnEvent>KEY_DOWN,VK113,,ClickOK
//send ctrl-o to dialogue window
SRT>ClickOK
Press CTRL
send>o
Release CTRL
END>ClickOK
Perhaps OnEvent doesn't work when using a Remote Desktop connection, as I am at the moment.
I hope someone will enlighten me.
Forgive me for the long and perhaps confusing post