how to make an AutoHotkey script wait for a GUI to completely load

364 Views Asked by At

I am trying to load a program via AutoHotkey script so I can identify the existance of an element on the loaded GUI. It normally takes about 15 seconds for everything on the scree to load completely and the balance of my script needs to wait for that to happen.

Being neww at coding had quite a bit of difficulty but the biggest current is my attempts to use WinWait and WinWaitActive. I cant get either to pause the script until fully loaded instead they both pass activity immediately after the window opens. Zero waiting regardless of the parameters I set.

The only success I had was with SetTimer repeatedly checking for the element I want from the moment the GUI starts loading. The issue with that solution is that it never stops checking and if I return to that initial screen it takes over again.

Any help would be appreciated.

1

There are 1 best solutions below

0
q-l-p On

Use Window Spy to get the name of the window you want to wait for. Then use:

WinWait("insert window name here")

I used AHK2 syntax because you used the AHK2 tag.