Jump to content

Array / WinList() Help


Athfar
 Share

Recommended Posts

I am trying to populate a Combo with WinList() and am having trouble (I don't think I understand how to use arrays with AutoIt).

Here's what I have so far.

Func gui_set_window_list()
    Local $window = WinList()
    Local $visable_windows
    
    For $i = 1 to $window[0][0]
; Only display visble windows that have a title
        If $window[$i][0] <> "" AND check_win_visibilty($window[$i][1]) Then
            $visable_windows[] = $window[$i][0]
        EndIf
    Next
    
    GUICtrlSetData($gui_target_window_combo, _ArrayToString($visable_windows, "|"))

EndFunc
Link to comment
Share on other sites

Try this :)

#include <array.au3>
GUICreate("")
$gui_target_window_combo=GUICtrlCreateCombo(" - Windows - ",50,50,150,100)
GUISetState()
PopulateCombo()
While GUIGetMsg()<>-3
    Sleep(50)
WEnd

Func PopulateCombo()
    $WinArray=WinList()
    For $i=1 To $WinArray[0][0]
        If _isVisible($WinArray[$i][1]) And $WinArray[$i][0]<>"" Then
            GUICtrlSetData($gui_target_window_combo,$WinArray[$i][0])
        EndIf
    Next
EndFunc

Func _isVisible($hWin)
    $state=WinGetState($hWin)
    If BitAnd($state, 2) Then
        Return True
    Else
        Return False
    EndIf   
EndFunc
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...