Home > Language Reference > Windows Management Functions > ChooseItem


The ChooseItem function selects an item in a listbox or a combobox or a tree view or a list view or a toolbar.


Used to select an item from a listbox, a combobox, a tree view, a list view or a toolbar. ChooseItem works only with native Windows controls. If ChooseItem cannot be used to select an item, you can try ClickOnText function or ClickOnTextOCR function or use multiple SendKeys("<Down>") and a last SendKeys("<Enter>") for selecting the desired item.


ret=ChooseItem(list|combo|treeview|listview|toolbar, <id>, <item>, single|double|expand|dropdown [, left|right] [, shift|ctrl])


list|combo|treeview|listview|toolbar, keyword, type of the Windows control.

<id>, string, identifier of the Windows control.

<item>, string, item to select.

single|double|expand|dropdown, keyword, action to do on the item. Single clicks once, Double makes a double click, Expand expands the specified treeview branch, Dropdown opens the specified toolbar menu.

left|right, optional, keyword, type of mouse button to click. Default is left.

shift|control, optional, keyword. Used only with list and listview. When a multiple selection is done, the shift keyword is used for the last item selected, or the ctrl keyword is used for each individual item selected (see the example below).

Return value

ret, optional numeric return value. If the specified item has been successfully selected within 30 seconds (this default value can be changed using #ActionTimeout), the function returns 0. If the function fails, the return value is a nonzero value (see Window Functions Error Codes).


Use Recording mode for generating automatically ChooseItem syntax.

If you need to select an item in the Notification Area (also called system tray on the right part of the taskbar), the WinTask x64 icon displayed at execution can interfere with the selection and it is recommended to deactivate this icon using #HidetrayIcon=1:
'Click Solve PC issues icon in the Notification Area
 ChooseItem(ToolBar, "User Promoted Notification Area", "Solve PC issues: 1 message", single, left )
'Select an option in the menu

See also



'ChooseItem ListView example
'Double click the desktop Recycle bin icon
UseWindow("EXPLORER.EXE|SHELLDLL_DefView|Program Manager|1",1)
 ChooseItem(ListView, "1", "Recycle Bin", double, left )


'ChooseItem TreeView example
Double click the desktop Recycle bin icon
UseWindow("EXPLORER.EXE|SHELLDLL_DefView|Program Manager|1",1)
 ChooseItem(ListView, "1", "Recycle Bin", double, left )
'In the Recycle window which opens, the left part is a treeview, click Local Disk (C:) item
UseWindow("EXPLORER.EXE|NamespaceTreeControl|Namespace Tree Control",1)
 ChooseItem(TreeView, "1", "Local Disk (C:)", single, left )

'ChooseItem Combo example
'Launch directly Control Panel/Date and Time
shell("control.exe timedate.cpl")
'Click Change time &zone button
UseWindow("RUNDLL32.EXE|#32770|Date and Time",1)
 Click(Button,"Change time &zone...")
UseWindow("RUNDLL32.EXE|#32770|Time Zone Settings",1)
'Select the new time zone in the Combo
 ChooseItem(Combo, "1", "(UTC+09:00) Osaka, Sapporo, Tokyo", single, left )