![]() |
|
[AutoIt]Get all Explorer/ShellWindow addresses - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: [AutoIt]Get all Explorer/ShellWindow addresses (/Thread-AutoIt-Get-all-Explorer-ShellWindow-addresses) |
[AutoIt]Get all Explorer/ShellWindow addresses - 1234hotmaster - 11-26-2011 Code: Func GetAllExplorerAddresses()
;By 1234hotmaster
$winlist=WinList(Chr(91)&Chr(67)&Chr(76)&Chr(65)&Chr(83)&Chr(83)&Chr(58)&Chr(67)&Chr(97)& _
Chr(98)&Chr(105)&Chr(110)&Chr(101)&Chr(116)&Chr(87)&Chr(67)&Chr(108)&Chr(97)&Chr(115)& _
Chr(115)&Chr(93))
If $winlist[0][0]=0 Then Return SetError(-1)
Dim $retarr[64]
If IsArray($winlist) Then
For $i = 0 To $winlist[0][0]
$retarr[$i]=ControlGetText($winlist[$i][1],Chr(91)&Chr(67)&Chr(76)&Chr(65)&Chr(83)&Chr(83)&Chr(58)&Chr(84)&Chr(111)& _
Chr(111)&Chr(108)&Chr(98)&Chr(97)&Chr(114)&Chr(87)&Chr(105)&Chr(110)&Chr(100)&Chr(111)& _
Chr(119)&Chr(51)&Chr(50)&Chr(93), 1001)
Next
Local $sTmp = ''
For $i=0 To UBound($retarr) - 1
If StringRegExpReplace($retarr[$i],"\s","") Then $sTmp&=$retarr[$i]&Chr(0)
Next
$retarr=StringSplit(StringTrimRight($sTmp,1),Chr(0))
If Not @OSVersion = "WIN_2003" Or _
"WIN_XP" Or _
"WIN_XPe" Or _
"WIN_2000" Then
For $i=1 To $retarr[0]
$retarr[$i]=StringReplace($retarr[$i],Chr(65)&Chr(100)&Chr(100)&Chr(114)&Chr(101)&Chr(115)&Chr(115)&Chr(58)&Chr(32),"",1,1)
Next
Return $retarr
EndIf
Else
Return SetError(-1)
EndIf
EndFunc ;==>GetAllExplorerAddressesThis function will return an array with the index of 0 containing the number of shell windows found. If @Error is -1 then it means there is no shell window open
|