Jump to content

Selecting item in existing (third party) listbox


Recommended Posts

Sorry if this has already been discussed, but I spent a lot of time searching the forum, and experimenting... without success.

Here is my problem. I am trying to automate a VirtualDubMod.exe video encoding application. Everything works fine, except when I get to this window that contains a listbox (title: "Available Streams".)

The AutoIt V3 Window Info says the following:

In Basic Control Info

Class: Listbox

Instance: 1

in the Control tab:

Class: Listbox

Instance: 1

ClassnameNN: Listbox1

Advanced (Class) [CLASS: Listbox, INSTANCE: 1]

ID: 1402

Text (blank)

...

The listbox may contain one or several items describing video streams, and I would like to do several things:

(1) Find an item that contains a specific string, and then select that item (that might be the most critical)

Other things I'd like to do, but not critically important:

(2) be able to select an item by rank: #1 or #3

(3) read the strings in the items in the listbox

(4) and/or find out how many items are in the listbox

(5) or, (lower priority) right click on each item and select one of the actions on the context menu, for example "Direct Stream Copy" or "Full Processing"

I have tried to do this, hoping to identify the item that contains: "Long_amer_drag.ac3"

WinWait("Available streams")
$r = ControlCommand("Available streams", "", "[CLASSNN:ListBox1]", "FindString", "Long_amer_drag.ac3")
MsgBox(4096, "Audio streams", " Reference $r = " & $r)

I get $r = 0 (the item that contains the string is in 2nd position), so that must be wrong.

I also tried, hoping to select the right item:

WinWait("Available streams")
$r = ControlCommand("Available streams", "", "[CLASSNN:ListBox1]", "SelectString", "Long_amer_drag.ac3")
MsgBox(4096, "Audio streams", " Reference $r = " & $r)

I also get $r = 0, and the selection doesn't move to the right item.

I haven't found many options to pursue. I hope someone will be able to point me in the right direction.

Thanks.

Link to comment
Share on other sites

For what it's worth, I also followed stilllife's in another post:

#include <GuiListBox.au3>
WinWait("Available streams")
$hdlList = ControlGetHandle("Available streams", "", "[CLASS: Listbox, INSTANCE: 1]")
_GUICtrlListBox_ClickItem($hdlList, 1, "right")

Hoping Item 1 (the second one) would get selected and the context menu would show up.

Strangely enough, a context menu appears, but unrelated to the target window. I get the desktop context menu instead!

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

×
×
  • Create New...