WinActive + Mehere Fenster

  • Hi Leute...
    Ich habe ein Problem, undzwar möchte ich mit WinActive überprüfen, ob mehre Fenster geöffnet sind, also, wenn ich z.B. den Ordner "LOL" öffne, eine MsgBox mit "LOL" drin kommt, und wenn ich den Ordner "LOL2" öffne, auch eine MsgBox mit "LOL" drin kommt. Kann mir da einer helfen? Sieht gerade so aus, geht aber nicht :D

    Spoiler anzeigen
    [autoit]

    while 1
    if WinActive($Process or $Process2) Then
    ;Das soll passieren
    EndIf
    WEnd

    [/autoit]


    Danke !

  • Hallo,

    ich weiß nciht genau was du machen willst, aber so geht es nicht ganz.
    Der Gedanke mit "or" ist richtig nur an der falschen stelle ;)

    Spoiler anzeigen
    [autoit]

    while 1
    if WinActive($Process) Or WinActivate($Process2) Then
    ;Das soll passieren
    EndIf
    WEnd

    [/autoit]


    Probiers aus, ich hoffe so geht es.

    mfg
    hauke96

  • Vielleicht hilft dir das weiter gibt dir so alle möglichen Informationen zurück welche man gebrauchen könnte um Fenster zu identifizieren...

    inkl. Beispiel:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    #include <Inet.au3>
    #include <Misc.au3>
    #include <Process.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $PID = Run(@WindowsDir & "\notepad.exe")
    msgbox(0,"",PIdGetWindow($PID,2,2))

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;============================================================================================
    ;
    ; Function Name: _PIdGetWindow
    ; Description: Returns the Windowhandle(s) owned by the specified process (PId only !).
    ;
    ; Parameter(s): $iPid - the owner-PID.
    ;
    ; $iWndState - WindowState´s (default = active Windows) Option´s as shown
    ; by Helpfile for WinGetState()
    ;
    ; $iOption - Optional : return/search methods :
    ; 0 - returns Processname for the window declared at $iWndState.
    ; 1 - returns new PID for the Process.
    ; 2 - returns WindowTitle for matches in $iWndState(default).
    ; 3 - returns WindowHandle for matches in $iWndState.
    ; 4 - returns WindowState for specified PId.
    ; 5 - returns an Array with all Data can found for Processes and Windows.
    ;
    ;
    ; Return Value(s): On Success - returns an Array (see below for $iOption method 5).
    ; $array[0][0] - number of Processes
    ; $array[x][0] - Processname
    ; $array[x][1] - ProcessId (if Process already exists, a new PId is given by this function)
    ; $array[x][2] - WindowTitle
    ; $array[x][3] - Windowhandle
    ; $array[x][4] - Windowstate
    ;
    ; On Failure - returns 0 and sets @error to 1.
    ;
    ; Note´s: For this Function, <Array.au3> & <Process.au3> must be included.
    ;
    ; Author(s): Stinger2K
    ;
    ;============================================================================================

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _PIdGetWindow($iPId,$iWndState=2,$iOption=2)
    Local $aResult[1]
    Local $var = _ProcessGetName($iPId)
    Local $test = ProcessExists($var)

    [/autoit] [autoit][/autoit] [autoit]

    If $test <> $iPId Then ; make sure that process exits once
    ProcessClose($var)
    EndIf
    ProcessWait($var)

    [/autoit] [autoit][/autoit] [autoit]

    Local $handle_name = WinList()

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $handle_name[0][0]
    ReDim $aResult[UBound($aResult) + 1][5]
    $aResult[UBound($aResult) - 1][0] = _ProcessGetName(WinGetProcess($handle_name[$i][1]))
    $aResult[UBound($aResult) - 1][1] = WinGetProcess($handle_name[$i][1])
    $aResult[UBound($aResult) - 1][2] = $handle_name[$i][0]
    $aResult[UBound($aResult) - 1][3] = $handle_name[$i][1]
    $aResult[UBound($aResult) - 1][4] = WinGetState($handle_name[$i][1])

    [/autoit] [autoit][/autoit] [autoit]

    If $aResult[$i][1] = $iPId and BitAND (WinGetState ($aResult[$i][3]),$iWndState) Then
    If $iOption=0 Then
    Return $aResult[$i][0] ; Processname
    ElseIf $iOption=1 Then
    Return $aResult[$i][1] ; new PID
    ElseIf $iOption=2 Then
    Return $aResult[$i][2] ; WindowTitle
    ElseIf $iOption=3 Then
    Return $aResult[$i][3] ; Windowhandle
    ElseIf $iOption=4 Then
    Return $aResult[$i][4] ; Windowstate
    EndIf
    Else
    EndIf
    Next
    If $iOption =5 Then
    _ArraySort($aResult)
    Return $aResult
    EndIf
    If $iOption >5 or $iOption <0 Then
    SetError(2)
    Return -2
    EndIf
    SetError(1)
    Return -1
    EndFunc ;==>PID2Window

    [/autoit]
    Spoiler anzeigen
    Zitat

    Ich weiß wo dein Haus wohnt... 8o