#include <AutoItConstants.au3> ;AdlibEnable(‘GetWindows’, 500); checks function ever 500 milliseconds… 250 is default ;#include
;Local $Test = StringSplit(GetWindows(1), Chr(01))
;_ArrayDisplay($Test, ‘array’) ;Local $Timer = TimerInit()
;While 1
; If TimerDiff($Timer) / 1000 >= .5 Then
; MsgBox(0, “”, GetWindows())
; $Timer = TimerInit(); start timer over
; EndIf
; Sleep(100)
;WEnd
Func _dbg($sMsg)
If @Compiled Then
DllCall(“kernel32.dll”, “none”, “OutputDebugString”, “str”, $sMsg)
Else
ConsoleWrite($sMsg & @CRLF)
EndIf
EndFunc Func GetWindows($ChangeToArray = ‘0’); call it with a 1 if you want an array
Local $List = WinList()
Local $ReturnWindows
Local $Seperator
If $ChangeToArray = 0 Then
$Seperator = @LF
Else
$Seperator = Chr(01)
EndIf
For $i = 1 to $List[0][0]
If BitAND(WinGetState($List[$i][1]), 2) And $List[$i][0] <> ” Then
$ReturnWindows = $ReturnWindows & $List[$i][0] & $Seperator
EndIf
Next ;_dbg(Ubound($ReturnWindows)) If $ChangeToArray = 0 Then
Return StringTrimRight($ReturnWindows, 1); just to show you how it works
Else
Return StringTrimRight($ReturnWindows, 1);<< Return it as an array
EndIf
EndFunc $list = ProcessList()
for $i = 1 to $list[0][0]
;_dbg($list[$i][0]);
;msgbox(0, $list[$i][0], $list[$i][0])
next _dbg(” -=-=-=-=-=-=-=-=- Getting Windows -=-=-=-=-=-=-=-=- “) ;_dbg(GetWindows(0)) $windowlist = StringSplit ( GetWindows(1), Chr(01) ) _dbg(Ubound($windowlist)) for $i = 1 to Ubound($windowlist) -1
;_dbg($windowlist[$i])
If StringInStr($windowlist[$i], “Google Chrome”) > 0 Then
_dbg($windowlist[$i])
WinSetOnTop($windowlist[$i], “”, $WINDOWS_ONTOP)
EndIf
next ;Example() Func Example()
; Retrieve the handle of the active window.
Local $hWnd = WinGetHandle(“Reboot required”)
WinSetState ( $hWnd, “”, @SW_HIDE )
EndFunc ;==>Example

Leave a Reply

Your email address will not be published. Required fields are marked *