Skip to content

Win List Items

Type: win-list-items  ·  Package: Desktop Activities v1.0.8  ·  Output: string[]

Returns all the items available in a ComboBox or list. Useful to know the options before choosing, to validate that the one you want exists, or to go through every option.

It locates the control by its selector (waiting up to timeout). If it is a drop-down combo box, it opens it, waits 200 ms for the options to show, reads each item’s text and closes it again. In a plain list it reads the items directly. In Java applications the options are read through the Swing bridge.

It doesn’t change the selected option.

ParameterTypeDefaultDescription
selectorselector—The ComboBox or list.
ParameterTypeDefaultDescription
sessionZoanDesktopSession—Win Attach session. Inside a body it is taken automatically; without a session, the selector must include the window.
timeoutnumber30000Maximum ms to wait for the control. Empty = the project’s UI timeout or, if not set, 30000.

Returns a string[] (array of texts) with each item’s text, in the order they appear. If the control has no items, it returns an empty array (not an error). The position of each text in the array (starting at 0) is the same one item accepts in Win Select.

MessageCause and fix
Element not found with selector {…}.See common errors.
The Java control could not be located unambiguously, so nothing was done. …In a Java app there are several identical combo boxes. Add an anchor or an idx to the selector.

If a combo box loads its options slowly when opened, the array may come back incomplete or empty: open it first with Win Click and wait for an option with Win Wait For.

Check that an option exists before selecting it:

Win List Items selector = (combo "Warehouse") → output: warehouses
If condition = warehouses.Contains("Main")
└─ then:
Win Select selector = (combo "Warehouse") item = "Main"

Go through every option:

Win List Items selector = (list "Reports") → output: reports
For Each items = reports itemVariable = report
└─ activities:
Log message = "Available: " + report