h711 Posted September 3, 2008 Posted September 3, 2008 Hi, I try to auto an installer. On one page, there is a list box with 3 items in it. How do I select one of these items? I use AutoIt V3 Window Info to scan the box, but it can only give me infor about this box, but not the items listed in the box. Control Class SysListView32 Instance 1 ClassnameNN SysListView321 Advanced(Class) [CLASS:SysListView32;INSTANCE:1] ID 1050 Test List1 Thanks for the help!
spudw2k Posted September 3, 2008 Posted September 3, 2008 Check out _GUICtrlListView_SetItemSelected in the help file. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
spudw2k Posted September 3, 2008 Posted September 3, 2008 (edited) Quick sample #include <GuiListView.au3> $h = WinGetHandle("[CLASS:Progman]") $hwnd = ControlGetHandle($h,"","SysListView321") WinActivate($h) For $i = 0 to _GUICtrlListView_GetItemCount($hwnd) - 1 _GUICtrlListView_SetItemSelected($hwnd,$i,True) Next Edited September 3, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
h711 Posted September 4, 2008 Author Posted September 4, 2008 (edited) I need some help for this. I used ControlCommand to wait until the listbox finishs searching all deviceds. This part is fine. The problem is, the _GUICtrlListView_SetItemSelected did not work as I wished. For this simple test, I want the automation to select and focus on the second item in the list box. The problem is, sometime the second item is selected, some time is focused, but it's kind random. If I manually use my mouse to click one of the items, the "Next" button will be enabled. But this script never enabled the "next" button. There must be something wrong with this code, please help me. Thanks! Do Sleep(50) Until ControlCommand("Installation Wizard", "", "[CLASS:Button; INSTANCE:10]", "IsEnabled") $h = WinGetHandle("[CLASS:SysListView32]") $hwnd = ControlGetHandle($h,"","SysListView321") _GUICtrlListView_SetItemSelected($hwnd,1, true, true) Edited September 4, 2008 by h711
PsaltyDS Posted September 4, 2008 Posted September 4, 2008 I need some help for this. I used ControlCommand to wait until the listbox finishs searching all deviceds. This part is fine. The problem is, the _GUICtrlListView_SetItemSelected did not work as I wished. For this simple test, I want the automation to select and focus on the second item in the list box. The problem is, sometime the second item is selected, some time is focused, but it's kind random. If I manually use my mouse to click one of the items, the "Next" button will be enabled. But this script never enabled the "next" button. There must be something wrong with this code, please help me. Thanks! Do Sleep(50) Until ControlCommand("Installation Wizard", "", "[CLASS:Button; INSTANCE:10]", "IsEnabled") $h = WinGetHandle("[CLASS:SysListView32]") $hwnd = ControlGetHandle($h,"","SysListView321") _GUICtrlListView_SetItemSelected($hwnd,1, true, true) Setting the item as selected does not trigger the onclick event for it, which is what the app detects when you click on it. Try _GUICtrlListView_ClickItem() after setting the selection with _GUICtrlListView_SetItemSelected(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
BbIXyXOJIb Posted July 23, 2009 Posted July 23, 2009 Hello There's SysListView32 and I want select item in it not by order. For example, in windows if there is an item in list called "printer" and I'm typing "pri" - the item "printer" will be selected according to this letters. How can I do this using AutoIt?
Rishav Posted July 23, 2009 Posted July 23, 2009 how about selecting the list view using the above mentioned commands. then send Pg Up to ensure the top most item is selected. then send "printer" finally click the selected item.
BbIXyXOJIb Posted July 23, 2009 Posted July 23, 2009 Thanks a lot, doing such way: $h = WinGetHandle("[CLASS:SysListView32]") $hwnd = ControlGetHandle($h,"","SysListView321") _GUICtrlListView_SetItemSelected($hwnd,1, true, true) ControlSend("Мастер установки оборудования", "", $hwnd, "{PGUP}") ControlSend("Мастер установки оборудования", "", $hwnd, "{ASC 8079}{ASC 8160}{ASC 9128}") for non-english captions does what I need. String has to be send in unicode.
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