john c. j.
john c. j.

Reputation: 1175

Can't activate Windows Explorer window

For some reason, I can't activate Windows Explorer window:

(I.e. default file manager. Not to be confused with Internet Explorer)

Any ideas how to fix it? Thanks.

I tried it on Win7, 32 bit. Probably it will work on newer Windows versions (I don't know).

#singleInstance, force

f1::
    ; This works:
    ; (Even if multiple Notepad windows are opened)
    ; winActivate, ahk_class Notepad ahk_exe Notepad.exe

    ; This doesn't work:
    ; (Even if only one Explorer window is opened)
    winActivate, ahk_class CabinetWClass ahk_exe explorer.exe
return

Upvotes: 1

Views: 796

Answers (1)

Relax
Relax

Reputation: 10543

What info shows this MsgBox?

f2::
list := ""
numberOfwindows := ""
wins := ""
WinGet, id, list, ahk_class CabinetWClass ahk_exe explorer.exe
Loop, %id%
{
    numberOfwindows := A_Index
    this_ID := id%A_Index%
    WinGetTitle, title, ahk_id %this_ID%
    wins .= A_Index A_Space title ? A_Index A_Space title "`n" : "" 
}
MsgBox, number of explorer windows = %numberOfwindows%`n`n%wins%
return

Upvotes: 2

Related Questions