In your script, the msgbox
has no relation to winactivate
unless you put group the commands.
Your script is firing like this:
- You push the hotkey.
- it checks for the window
- if the window exists, it activates it.
- NOW - r gets sent no matter if #3 checked out or not!
- The message box gets displayed no matter what happens.
Consider this, when you push the hotkey, nothing happens unless the window exists. If the window exists, all of your commands will get processed.
#V::
ifwinexist, Manual Runner
{
winactivate
Send ^R
msgbox, pass
}
return
If you have trouble sending the keys, you might look up sendkeys
for some alternative methods: Send / SendRaw / SendInput / SendPlay / SendEvent
Also, look at setkeydelay
.
Another idea is to add sleep 500
just after winactivate
.