Page 1 of 1

water-tight window activating sequence?

Posted: 20 Oct 2016, 05:41
by paik1002
I'd like to make sure that Windows Explorer (or any other program for that matter) is up and running,
before proceeding on to some other jobs.

The following code has some rigorous checking stages that make sure Windows Explorer is active and ready.

Code: Select all

#e::
RunWait, Explorer.exe
Sleep 300				; is there an alternative to this?
IfWinExist ahk_class CabinetWClass
{
        Winactivate ahk_class CabinetWClass
        WinWaitActive ahk_class CabinetWClass
        if ErrorLevel
        {
            MsgBox, WinWait timed out.
            return
        }        

        ifWinactive ahk_class CabinetWClass
        {
            msgbox windows explorer is up and ready!
        }
        return
}
I'd like to know if these intermediary checking steps are sufficient.
Also, is there a way to replace the sleep command? Perhaps with a timed loop?
Any tips & hints are welcome.

Re: water-tight window activating sequence?

Posted: 20 Oct 2016, 05:57
by drawback
RunWait?
It waits until that program was quit!

Use WinWait instead of Sleep