Trouble with winwaitactive

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
mero
Posts: 11
Joined: 20 Aug 2017, 14:54

Trouble with winwaitactive

20 Aug 2017, 15:24

Hi, complete newbie here. I hope you can help me with this :)

Code: Select all

F3::
KeyWait, F3
Send, !vm
WinWaitActive, Comments,"",2 Then
	Send, !a
return
My goal:

If F3 is released -> send ALT+V+M ->
Wait until the Comments windows appears
If it appears-> press Ctrl B
If it doesn't appear within 2 seconds -> Do nothing


What is actually happening:
The script doesn't appear to care if the comments window is open or not. It will still send Alt A after the timeout.

edit:
i've also tried:

Code: Select all

F3::
KeyWait, F3
Send, !vm
WinWaitActive, Comments, ,2 
if ErrorLevel 
{
MsgBox, WinWait timed out.
    return
}
else
Send, !a
return
This only works half the time for some reason. Sometimes it works and sometimes it times out. Raising the time doesn't seem to help. =/

Double Edit:

I think I might have fixed it. Going to try testing this at work tomorrow. I don't have the software at home to confirm.

Code: Select all

F3::
KeyWait, F3
Send, !vm
Sleep, 100
WinWait, Comments, ,2 
if ErrorLevel 
{
MsgBox, WinWait timed out.
    return
}
else
Send, !a
return
Please let me know if there is a cleaner way to do this.
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Trouble with winwaitactive

22 Aug 2017, 19:35

You should try to be as specific as possible when using a WinTitle parameter. If there is another window that matches that title, it'll wait for that one instead. Try using the class name or process name instead/coupled with the readable name.

You can also replace the first two lines with F3 up::.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ulysim, w_i_k_i_d and 314 guests