Charly3307 Posted January 29, 2014 Posted January 29, 2014 (edited) I'm trying to double-click on a listview item and don't find how. I call the Find printer window, search for the wanted printer then I need to double-click on the listview item to install it but can't find how. Here is the code I use. Func InstallPrinters($PrinterName) ShellExecute("C:Program Files (x86)BAAD Printer LookupPrinters.qds") WinWaitActive("Find Printers") $PrinterWindowHandle = WinGetHandle("Find Printers") ;Get handle on Find printer window ControlSetText($PrinterWindowHandle,"","[CLASS:Edit; INSTANCE:1]",$PrinterName) ; Put printer number into search field $ListViewHandle = ControlGetHandle($PrinterWindowHandle,"","[CLASS:SysListView32; INSTANCE:7]") ;Get handle on the listview ;****** Would like to double-click on the item in the listview here ******* EndFunc Any help will be appreciated. Got some new progress. I have change the code to right-click instead of left-click to get a contextual menu and see were it click. It should click on the first item but it click on the top-left coner of the listview what ever the item number I choose. Here is my code. Func InstallPrinters($PrinterName) ShellExecute("C:Program Files (x86)BAAD Printer LookupPrinters.qds") WinWaitActive("Find Printers") $PrinterWindowHandle = WinGetHandle("Find Printers") ;Get handle on Find printer window GUICtrlSetState($PrinterWindowHandle,$GUI_FOCUS) ControlSetText($PrinterWindowHandle,"","[CLASS:Edit; INSTANCE:1]",$PrinterName) ; Put printer number into search field WinWait("Find Printers","",2) $ListViewHandle = ControlGetHandle($PrinterWindowHandle,"","[CLASS:SysListView32; INSTANCE:7]") ;Get handle on the listview if @error Then ; add error handling here Else _GUICtrlListView_ClickItem($ListViewHandle, 1, "right", True, 1) ;Click on first item in listview, does not work EndIf EndFunc Edited January 31, 2014 by Charly3307
philking Posted June 5, 2014 Posted June 5, 2014 Dear Charly3307, I have recently started using AutoIt and I came across your post. I am also trying to automate a listview. According to the documentation that comes with AutoIt3, the 2nd parameter ($iIndex) is the zero based index of the item. so to click on the 1st item you need: _GUICtrlListView_ClickItem($ListViewHandle, 0, "right", True, 1) instead of _GUICtrlListView_ClickItem($ListViewHandle, 1, "right", True, 1) ;Click on first item in listview, does not work Best regards philking
mikell Posted June 5, 2014 Posted June 5, 2014 ? $ListViewHandle = ControlGetHandle($PrinterWindowHandle, "", "[CLASS:SysListView32; INSTANCE:7]") ControlListView($PrinterWindowHandle, "", $ListViewHandle, "Select", 0) ControlSend($PrinterWindowHandle, "", $ListViewHandle, "{enter}")
Bert Posted June 5, 2014 Posted June 5, 2014 On 6/5/2014 at 2:07 PM, philking said: Dear Charly3307, I have recently started using AutoIt and I came across your post. I am also trying to automate a listview. According to the documentation that comes with AutoIt3, the 2nd parameter ($iIndex) is the zero based index of the item. so to click on the 1st item you need: _GUICtrlListView_ClickItem($ListViewHandle, 0, "right", True, 1) instead of _GUICtrlListView_ClickItem($ListViewHandle, 1, "right", True, 1) ;Click on first item in listview, does not work Best regards philking You know this guy has not been on since February 6th? Odds are he may never be back. Necro posting ...... look at the date of when the post was before you answer back. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now