Macro Scheduler 15

GetListItem

GetListItem>WindowTitle,ClassName,Instance,Text,Column,Case,Partial,Result,Handle

 

Returns in Result the row index of the text specified in Text in the specified ListView (List Box) object.

 

WindowTitle: The title of the window containing the ListView object

ClassName: Usually SysListView32 but may differ.  Use View System Windows to determine class name.

Instance: The zero based index of the instance to use (a window may contain several listview objects).

Text: The text to search for in the list box.

Column: The column number to search in.  0 for first column or if only one column.

Case: 1 to perform a case sensitive match, 0 for non-case sensitive.

Partial: 1=partial, 0=full.  A partial match will match Text at the start of the item text.

Result: Gets set to the zero based index of the item or -1 if not found.

Handle: Gets set to the handle of the ListView object.

 

The zero based index is returned in Result.  Handle will be set to the handle of the ListView object.

 

Some list boxes allow you to "drill down" to the item you want by typing the value of the item.  To select an item in these kinds of boxes all you therefore need to do is send keystrokes to them using the Send command.  However, some list boxes do not "drill down" and this is where GetListItem is needed.  You may know the item text you want to select but can not predict it's index.  Use GetListItem to retrieve the index and then you know how many times to "Press Down".

 

WindowTitle can end with an asterisk to indicate a substring match.  WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted.  See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.

 

Abbreviation: GLI

See also: GetTreeNode

 

Example

 

This example uses GetListItem to retrieve the index of an item in the Display Properties backgrounds box.

 

//Open Display Properties
Run>rundll32 shell32.dll,Control_RunDLL Desk.cpl
WaitWIndowOpen>Display Properties
 
//Select Desktop Tab
Press CTRL
Press TAB
Release CTRL
WaitReady>0
 
//Get listindex of "Azul" in Background box
GetListItem>Display Properties,SysListView32,0,Azul,0,0,0,nDx,lvHwnd
 
//Select it
Press Home
Press Down * nDx
 
WaitReady>0
 
//OK!
Press Enter