Hi there
I have written a script which will basically number all open notepad windows or windows explorer windows as consecutive numbers depending on the order from topmost to bottommost, that is if it find a notepad it will be name 1 , another notepad 2, a window explorer 3
however i think that there is a problem with my ' if statement as it does not seem to recognise notepad or windows explorer could anyone please tell me what the problem is?
n=1
WinGet, id, list,,, Program Manager
Loop, %id%
{
this_id := id%A_Index%
WinGet, WinState, MinMax, ahk_id %this_id%
If ( WinState <> 0 )
titles := A_Index ; keep track of how many windows in list
WinGetTitle, titles%A_Index%, ahk_id %this_id% ; save original title
titles%A_Index% .= "`n" this_id ; and its ahk_id
WinGetTitle, this_title, ahk_id %this_id%
WinGetClass, this_class, ahk_id %this_id%
if this_class = Notepad,CabinetWClass
{
WinSetTitle,ahk_id %this_id%,, %n%
n := n + 1
}
MsgBox, 4, , Visiting All Windows`n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n`nContinue?
IfMsgBox, NO, break
}
msgbox, %titles%
; restore titles
Loop, %titles%
{
StringSplit, windowInfo, titles%A_Index%, `n
WinSetTitle, ahk_id %windowInfo2%,, %windowInfo1%
msgbox, %windowInfo2% %windowInfo1%
}