Jump to content

WinList


Recommended Posts

$var = WinList()

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
    Call("ExEcheck")
    Call("DLLcheck")
    call("COMcheck")
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

Func ExEcheck()
    ;If Tittle reads(".exe") then     <----- lol just to give you idea 
    MsgBox(0,"tittle","Exe was found")
EndFunc
Func DLLcheck()
    ;If Tittle reads(".Dll") then
    MsgBox(0,"tittle","Dll was found")
EndFunc
Func COMcheck()
    ;If Tittle reads(".COM") then
    MsgBox(0,"tittle","COM was found")
    EndFunc

as i did read the help file for StringInStr...

im not understanding the proper use of StringInStr

Link to comment
Share on other sites

  • Moderators

Errr.... You don't have any conditions to even check if something was found to do something, you are only calling if it is visible and not an empty string (Straight out of the help file it looks like).

$var = WinList()
For $i = 1 To $var[0][0]
    If $var[$i][0] <> "" And BitAND(WinGetState($var[$i][1]), 2) Then
        If StringInStr($var[$i][0], '.exe') Then
            _ExECheck($var[$i][0], $var[$i][1])
        ElseIf StringInStr($var[$i][0], '.dll') Then
            _DLLCheck($var[$i][0], $var[$i][1])
        ElseIf StringInStr($var[$i][0], '.com') Then
            _COMCheck($var[$i][0], $var[$i][1])
        EndIf
    EndIf
Next
Func _ExECheck($sWin, $hWnd)
    ;If Tittle reads(".exe") then     <----- lol just to give you idea
    MsgBox(0, "tittle", "Exe was found" & @CR & 'WinName = ' & $sWin & @CR & 'Handle = ' & $hWnd)
EndFunc   ;==>_ExECheck
Func _DLLCheck($sWin, $hWnd)
    ;If Tittle reads(".Dll") then
    MsgBox(0, "tittle", "Dll was found" & @CR & 'WinName = ' & $sWin & @CR & 'Handle = ' & $hWnd)
EndFunc   ;==>_DLLCheck
Func _COMCheck($sWin, $hWnd)
    ;If Tittle reads(".COM") then
    MsgBox(0, "tittle", "COM was found" & @CR & 'WinName = ' & $sWin & @CR & 'Handle = ' & $hWnd)
EndFunc   ;==>_COMCheck

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...