Click doesn't work after WinWaitClose

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
michalb93
Posts: 46
Joined: 29 Sep 2022, 04:35

Click doesn't work after WinWaitClose

Post by michalb93 » 29 Sep 2022, 04:49

So, my code looks like that:

Code: Select all

Click, 1981 181, 2  ; connect
Sleep 100
Click, 63 89  ; com12
Sleep 100
Click 421 85  ; Management
Sleep 50
WinWaitClose, A
Click, 455 51
[Mod edit: [code][/code] tags added; replaced quote tags.]

It clicks everything fine, until WinWaitClose appears. Here is just a "loading window" I want to disappear, THEN it should click 455 51, but it doesn't. I gave A for active window, which is this "loading window". Why so?

User avatar
mikeyww
Posts: 26879
Joined: 09 Sep 2014, 18:38

Re: Click doesn't work after WinWaitClose

Post by mikeyww » 29 Sep 2022, 06:37

Welcome to this AutoHotkey forum!

In your case, the active window is probably a window other than what you expected, possibly more than once.

You can display the title of the active window, so that you understand what it is.

Just a demonstration:

Code: Select all

WinWaitClose, % "ahk_id" showActive().hWnd       ; Wait for active window to close
MsgBox, 48, About to click, % showActive().title ; Display newly active window title
Sleep, 50
Click, 455 51                                    ; Coordinates relative to active window
showActive(False)                                ; Disable the ToolTip
MsgBox, 64, Done, Done!

showActive(show := True) {
 hWnd:= WinActive("A")                           ; HWND of active window
 WinGetActiveTitle, title
 ToolTip, % show ? "Active: " title : ""
 Return {hWnd:hWnd, title:title}
}

michalb93
Posts: 46
Joined: 29 Sep 2022, 04:35

Re: Click doesn't work after WinWaitClose

Post by michalb93 » 29 Sep 2022, 07:15

Well, I see that it's like 'inside window', this window has same process name, ids etc. Only name of window is different. Checked it in Window Spy - it treats this 'mini window' like 'main window'.

michalb93
Posts: 46
Joined: 29 Sep 2022, 04:35

Re: Click doesn't work after WinWaitClose

Post by michalb93 » 29 Sep 2022, 07:17

+Made it work by changing "A" to window name, so it looks like

Code: Select all

WinWaitClose, Working ...
and works now!

Post Reply

Return to “Ask for Help (v1)”