quick little function i put together due to someone having a bug where AHK_EXE was not working that can find any window attribute from any other attribute, for instance
if you want to get the PID from the window transparency? sure!
how about the name of the EXE from the window style? absolutely!
perhaps get the exe name from the PID, then the window name from the exe name? perfectly possible
leave all the parameters blank and it will return an array containing all the data it has from every window
see the 2d array lines below for a list of options you can choose from, enjoy!
Code: Select all
msgbox % st_printarr(WinGetAll(), 15)
msgbox % wingetall("proc", "notepad.exe", "PID")
msgbox % wingetall("PID", wingetall("proc", "notepad.exe", "PID"), "Name")
WinGetAll(InType = "", in = "", outtype = "")
{
WinGet,wParam, List
Window:={}
loop %wParam%
{
WinGetpos, X%A_Index%, Y%A_Index%, Width%A_index%, Height%A_index%, % "ahk_id " wParam%A_Index% ;m
WinGetTitle, WinName%A_Index%, % "ahk_id " wParam%A_Index% ;a
winget, State%A_index%, MinMax, % "ahk_id " wParam%A_Index% ;d
winget, ID%A_index%,ID , % "ahk_id " wParam%A_Index% ;e
winget, PID%A_index%,PID, % "ahk_id " wParam%A_Index% ;
winget, Count%A_index%,Count, % WinName%A_Index% ;b
winget, Proc%A_index%, ProcessName, % "ahk_id " wParam%A_Index% ;y
winget, cList%A_index%, ControlList, % "ahk_id " wParam%A_Index% ;
winget, cListHWND%A_index%, ControlListHWND, % "ahk_id " wParam%A_Index% ;b
winget, trans%A_index%, transparent, % "ahk_id " wParam%A_Index% ;u
winget, transc%A_index%, transcolor, % "ahk_id " wParam%A_Index% ;g
winget, style%A_index%, style, % "ahk_id " wParam%A_Index% ;z
Window[ A_index , "Name" ] := WinName%A_index% ;0
Window[ A_index , "State" ] := State%A_Index% ;0
Window[ A_index , "AHK_ID" ] := wParam%A_Index% ;0
Window[ A_index , "ID" ] := ID%A_Index%
Window[ A_index , "PID" ] := PID%A_Index%
Window[ A_index , "Proc" ] := Proc%A_Index%
Window[ A_index , "Count" ] := Count%A_Index%
Window[ A_index , "cList" ] := cList%A_Index%
Window[ A_index , "cListHWND" ] := cListHWND%A_Index%
Window[ A_index , "trans" ] := trans%A_Index%
Window[ A_index , "transc" ] := transc%A_Index%
Window[ A_index , "style" ] := style%A_Index%
Window[ A_index , "X" ] := X%A_Index%
Window[ A_index , "Y" ] := Y%A_index%
Window[ A_index , "Width" ] := Width%A_Index%
Window[ A_index , "Height" ] := Height%A_Index%
Window[ A_index , "Area" ] := Width%A_Index% * Height%A_Index%
if (intype) AND (in) AND (outtype)
if (Window[A_index, intype] = in)
return % window[a_index, outtype]
}
if (intype) AND (in) AND (outtype)
return "Error, intype or in not found."
return % window
}
st_printArr(array, depth=5, indentLevel="")
{ ;made by tidbit
for k,v in Array
{
list.= indentLevel "[" k "]"
if (IsObject(v) && depth>1)
list.="`n" st_printArr(v, depth-1, indentLevel . " ")
Else
list.=" => " v
list.="`n"
}
return rtrim(list)
}