Jump to content

SelectString LIKE in ControlListView


LukasChury
 Share

Go to solution Solved by LukasChury,

Recommended Posts

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

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.

obrazek.png.28da0e5063926402e31c03cf4e63d0fd.png

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 by LukasChury
Link to comment
Share on other sites

  • Solution
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 by LukasChury
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...