Sign in to follow this  
Followers 0


4 posts in this topic

New here - only just started working with AutoIt for the first time last week.  I am using AutoIt to automate several different executables/Install Wizards, most of which are from printer manufacturers to install their drivers and select the one you want to create printers (Windows 7).  I've completed about 4 of these so far. 

I have finally come upon my first ListBox - except according to Window Info, it is a "TEPListBox.UnicodeClass."  Have no idea if that makes a difference or not.  I have searched the Wiki here and searched many other forums - almost all seem to be about how to create your own GUIs with ListBoxes, but I'm finding very little on selecting a single item from a ListBox.  This window has two ListBoxes - the first one is a "TListBox" with just one option, so I don't have to worry about that.  The 2nd ListBox is this "TEPListBox" with about 120 printer names listed.  I just need to select/highlight the printer name we need and then hit the "Next" button, but I guess maybe I'm using the wrong commands (with what I could find online).  Here is the Summary of the Window Info for this 2nd ListBox:

>>>> Control <<<<
Class:    TEPListBox.UnicodeClass
Instance:    1
ClassnameNN:    TEPListBox.UnicodeClass1
Advanced (Class):    [CLASS:TEPListBox.UnicodeClass; INSTANCE:1]
ID:    2294372
Position:    248, 148
Size:    233, 121
ControlClick Coords:    76, 72
Style:    0x54210941
ExStyle:    0x00000200
Handle:    0x0000000000230264

>>>> Mouse <<<<
Position:    715, 564
Cursor ID:    0
Color:    0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Next >
< &Previous
&Change location...

>>>> Hidden Text <<<<


And here are some of the commands I've tried:

ControlCommand ("Selecting The Printer", "", "[CLASS:TEPListBox.UnicodeClass; INSTANCE:1]", "SelectString", "ZDesigner LP 2844")

ControlCommand ("Selecting The Printer", "", "[CLASS:TEPListBox; INSTANCE:1]", "SelectString", "ZDesigner LP 2844")

ControlCommand ("Selecting The Printer", "", "[CLASS:ListBox; INSTANCE:1]", "SelectString", "ZDesigner LP 2844")

ControlCommand ("Selecting The Printer", "", "[CLASS:ListBox]", "SelectString", "ZDesigner LP 2844")

Highlight just stays on the first option in the ListBox with all of these, so not sure where to proceed.  Or is ControlCommand just not the way I want to go here?  One other thing - there is a lot of text in this window, but what's listed as "Visible text" is just the text in each of the four buttons below.  There is "Printers" above this ListBox (the "P" is underlined), but that is not listed as a "Visible text" for this window and I'm not sure why.

Thank you

Share this post

Link to post
Share on other sites

Got an answer from a co-worker whom I discovered used to use AutoIt.  Not the cleanest answer, but it works.  He looked at this particular Install Wizard and says it was "implemented in a non-standard way", so standard GUIListBox commands may not work/help.

I'm having to do a

Send ("{TAB 6}")

just to get to the ListBox, and then a

Send ("{DOWN 67}")

to scroll down to my particular selection.  Again, probably not the "accepted" way it should be handled - but it's working!

Share this post

Link to post
Share on other sites

Most installation programs come with command line switches to let you do a silent install. Did you check this for your programs?

My UDFs and Tutorials:


Active Directory (NEW 2017-04-18 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version - Download - General Help & Support

ADO - Wiki


Share this post

Link to post
Share on other sites

Most installation programs come with command line switches to let you do a silent install. Did you check this for your programs?


For these particular installs, there is a point where the user must install a USB cable before the install will continue, hence our need for AutoIt so they can see when it stops that it's time to install their cable before it will continue on.

Share this post

Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • hcI
      By hcI
      Today I'm working on listbox but there might be something that I'm missing...
      I made a little script that allow the user to swap 2 items for the listbox. So the user select for example the 3rd item, press the button "Up" and it switch with the 2nd one, same with the "Down" button that switch with the 4th one.
      But when I select the 3rd item and switch it the item become unselected and I would like to select it again after the manipulation :
      As you can see in the comment of the script, _GUICtrlListBox_SetSel don't highlight/select them once the swap process is done..
      What am I missing ?
    • Daka
      By Daka
      I know there are listbox and listview, but now I have?
      here is the video of infowindow 
      I tried to read mouse selection like for listbox:
      $listWindow = "[CLASS:TFormResearchGR]" $topicsList = "[CLASS:TMWrapper; INSTANCE:255]" WinWait($listWindow, "", 60) $hdlWindow = WinGetHandle($listWindow) $hdlList = ControlGetHandle($hdlWindow, "", $topicsList) _GUICtrlListBox_ClickItem($hdlList, 0, "left") $countOfList = _GUICtrlListBox_GetCount($hdlList) ConsoleWrite("Count of list: " & $countOfList & @LF) count of list is not working.
      I realiezed that there are difference between listbox and listview, but this is something different.
      and till now I never saw that you can go inside with infotool and also get instances.
      so Im confused how to get the list number and the names of selection?
    • Guy_
      By Guy_
      This is not a working example -- I'm asking about the principle...
      Here we have the often seen code to detect a double-click on an item in one ListBox (ID in $idListBox is of course created by other code).
      To catch that ListBox item, I have only added $sBookmark to it. This could be a pick list application.
      $idListBox = 0x004A0FB0 GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, _ $sBookmark If Not IsHWnd($idListBox) Then $hWndListBox = GUICtrlGetHandle($idListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $idListBox, $hWndListBox $sBookmark = _GUICtrlListBox_GetText( $hWndFrom, _GUICtrlListBox_GetCurSel($hWndFrom) ) Switch $iCode Case $LBN_DBLCLK ConsoleWrite("you double-clicked " & $sBookmark & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc  
      Now, my question is: can one modify the _WM_COMMAND function to allow for a dynamic number of ListBoxes? (meaning, user-defined -- the amount of ListBoxes/pick lists can change at any time).
      Let's assume I dynamically obtained an array with ListBox ID's for (in this case) 5 pick lists:

      One part of the solution seems to work with the For... Next loop I added below, but I'm wondering if that is the ultimate? (knowing this Func has to be as fast as possible)
      The part where I can't find anything that works for a dynamic amount of ListBox ID's is in the Case check...
      I tried _ArrayToTxt($aIdListBox, ", ", 1), messed with Eval(), and trying Case $aIdListBox[start] To $aIdListBox[end]
      Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, _ $sBookmark For $i = 1 To UBound($aIdListBox) - 1 ; is this solution fast enough? (it seems to work well) If Not IsHWnd($aIdListBox[$i]) Then $hWndListBox = GUICtrlGetHandle($aIdListBox[$i]) ExitLoop ; cause there can only be one hit(?) EndIf Next $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case [WHAT TO PUT HERE if nr of ListBoxes is dynamic?], $hWndListBox ; <= MAIN question $sBookmark = _GUICtrlListBox_GetText( $hWndFrom, _GUICtrlListBox_GetCurSel($hWndFrom) ) Switch $iCode Case $LBN_DBLCLK ConsoleWrite("you double-clicked " & $sBookmark & @CRLF) EndSwitch Return $GUI_RUNDEFMSG EndFunc - - -
      As a workaround, I can probably add the maximum number of allowed ListBoxes to the Case check, seperated by commas, but only display the number of ListBoxes needed. But I'm hoping it can be made truly dynamical...?
      Thank You : )
    • Codartizan
      By Codartizan
      Hi Guys
      I got a problem, hope someone can help me, many thanks.
      I'm trying to read items from a listbox1($ListChoCom) to an array, and load this array to another listbox2($ListSuitCmd) which is on the different  tab. But, now, I cannot select items on the listbox2. I only can select from listbox1. Here is the code and the screenshots.
      Func btnNext2() Dim $SelCmdArray[10] For $i = 0 To _GUICtrlListBox_GetCount($ListChoCom) - 1 $SelCmdArray[$i] = _GUICtrlListBox_GetText($ListChoCom, $i) ReDim $SelCmdArray[UBound($SelCmdArray) + 1] GUICtrlSetData($ListSuitCmd, $SelCmdArray[$i]) Next _GUICtrlTab_ClickTab($Tab1, 2) EndFunc Screenshot 1: I can select item from this listbox1.

      screenshot2: I cannot select item from listbox2, The item that been highlight is what I select from listbox1.

      Thank you very much indeed.
    • kcvinu
      By kcvinu
      Hi all,
      I am playing with GUIRegisterMsg function for learning it. This is my code. It is not working. The error msg is this
      Variable used without being declared.:
      $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
      $tNMHDR = DllStructCreate($tagNMHDR, ^ ERROR
      I can't find lParam as a declared variable in _GUICtrlListView_Create.au3 in help file.
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <MouseOnEvent.au3> #include <Alert.au3> #include <ListBoxConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=K:\GUI Reg Msg Test works\GRM test GUI.kxf Global $Form1 = GUICreate("Form1", 611, 430, 260, 140) GUISetFont(12, 400, 0, "Segoe UI") GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") Global $Button1 = GUICtrlCreateButton("Button1", 368, 360, 137, 49) GUICtrlSetOnEvent(-1, "Button1Click") Global $List1 = GUICtrlCreateList("", 16, 216, 161, 181) GUICtrlSetOnEvent(-1, "List1Click") Global $Combo1 = GUICtrlCreateCombo("Combo1", 352, 24, 193, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetOnEvent(-1, "Combo1Change") Global $Input1 = GUICtrlCreateInput("Input1", 48, 32, 169, 33) GUICtrlSetOnEvent(-1, "Input1Change") Global $Edit1 = GUICtrlCreateEdit("", 248, 80, 321, 161) GUICtrlSetData(-1, "Edit1") GUICtrlSetOnEvent(-1, "Edit1Change") GUIRegisterMsg($WM_NOTIFY,"List1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $tmp = ["Orange","Apple","Banana","Papaya","Grapes"] For $i = 0 to 4 GUICtrlSetData($List1,$tmp[$i]) Next While 1 Sleep(100) WEnd Func List1Click($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom,$iIDfrom, $iCode, $tNMHDR, $hWndList, $tInfo $hWndList = $List1 if Not IsHWnd($List1) Then $hWndList = GUICtrlGetHandle($List1) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR,"hWndFrom")) $iIDfrom = DllStructGetData($tNMHDR,"IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $List1 Switch $iCode Case $LBN_DBLCLK ;$tInfo = DllStructCreate($tagNMMOUSE) Alert("You Clicked Twice") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc This gui is only for learning pupose. So please don't mind its aesthetic style.