LukasChury Posted September 27, 2022 Share Posted September 27, 2022 Hi, in classic ComboBox I can select value by string: ControlCommand($hWnd, "", "[CLASSNN:ThunderRT6ComboBox13]", "SelectString", "ValueIwantToSelect") But if I have ListBox (or ListView/ListView32?), I cant use "SelectString" method, i can only use: ControlListView($hWnd, "", "[CLASSNN:ThunderRT6ComboBox13]", "Select", 5) ... where I select a value, which is fifth in order. But how select by value? How can I select value by string in ListView32? In function reference there are no function "SelectString", only "Select". Thank you. Link to comment Share on other sites More sharing options...
ahmet Posted September 28, 2022 Share Posted September 28, 2022 You can use "FindItem" which should return the position of an item based on string value. Then you can use "Select" with that position. Link to comment Share on other sites More sharing options...
LukasChury Posted September 29, 2022 Author Share Posted September 29, 2022 (edited) On 9/28/2022 at 5:57 AM, ahmet said: You can use "FindItem" which should return the position of an item based on string value. Then you can use "Select" with that position. I propably dont know, how to use it... I have this: So, I know the ClassnameNN. In code I have: Local $hWnd = WinWait("Laser", "", 0) $hernimodid = ControlListView ($hWnd, "", "[CLASSNN:ListView20WndClass5]", "FindItem", "D - Thor") ControlListView ($hWnd, "", "[CLASSNN:ListView20WndClass5]", "Select", $hernimodid) But variable $hernimodid is '-1', so FindItem cant find this Item... This code works, so problem is with the "FindItem": (this code select Item 6 in order - as it count from 0) ControlListView ($hWnd, "", "[CLASSNN:ListView20WndClass5]", "Select", 5) Any tips? Thanks. EDIT: After search on this forum, in one topic a member say: Quote Also, the "FindItem" action doesn't work on Win64. You never mentioned your OS, and the GUI looks skinned, so I thought I would mention it. So, if I have Win64...? (of course I have, who not in these day 🙂 ) Is that problem? Edited September 29, 2022 by LukasChury Link to comment Share on other sites More sharing options...
LukasChury Posted September 29, 2022 Author Share Posted September 29, 2022 $i = 5; $sFile = ControlListView($hWnd, "", "[CLASSNN:ListView20WndClass5]", "GetText", $i, 1) ConsoleWrite($i & @TAB & $sFile & @CRLF) Does not work either. Return only number (index of): 5 Any help please? Link to comment Share on other sites More sharing options...
ahmet Posted September 29, 2022 Share Posted September 29, 2022 Look at _guictrllistview_findtext and _guictrllistview_setitemselected LukasChury 1 Link to comment Share on other sites More sharing options...
Solution LukasChury Posted September 29, 2022 Author Solution Share Posted September 29, 2022 (edited) 1 hour ago, ahmet said: Look at _guictrllistview_findtext and _guictrllistview_setitemselected Thank you! 🙂 Works like a charm. Final code, that works - for everyone, who would like this too: #Include <GuiListView.au3> Local $hWnd = WinActivate("TitleOfTargetWindow") $handle = ControlGetHandle("TitleOfTargetWindow", "", "[CLASSNN:ListView20WndClass5]") $i = _GUICtrlListView_FindText ($handle, "TextIwantToFind") ControlListView ($hWnd, "", "[CLASSNN:ListView20WndClass5]", "Select", $i) Edited September 29, 2022 by LukasChury Link to comment Share on other sites More sharing options...
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