0
votes

I am trying to automate some qc ( Quality Center ) tasks through Autohotkey.

Find below the code, It identifies and activates the QC > Test Run window, but after that the send keys function is not working. But the code is executed fully without any error and the final msgbox is displayed properly. Please help me !!

#V::
ifwinexist, Manual Runner
winactivate
Send ^R
msgbox, pass
1

1 Answers

1
votes

In your script, the msgbox has no relation to winactivate unless you put group the commands.

Your script is firing like this:

  1. You push the hotkey.
  2. it checks for the window
  3. if the window exists, it activates it.
  4. NOW - r gets sent no matter if #3 checked out or not!
  5. 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.