Forum Discussion
The recorder produced:
WindowObj.PopupMenu.Click("[0]") and I want to use the actual name value of the item.
(I edited my previous statement as it might have misled you.)
- sbkeenan10 years agoFrequent Contributor
Presumably you have looked at the available methods and cannot find a 'ClickItem' method, which allows you to specify the text? In which case, the control should have wItem and wItemCount properties, which should allow you to loop through the items and search for the text you are looking for. Once you find a match, obtain the item's index and select it based on that. Somehing along these lines:
[code=JScript]
var myControl = <a reference to your control>;
var myOption = "<menu option text here>";
var found = false;
for (var i = 0; i < myControl.wItemCount; i++) //locate the item's index number
{
if (myControl.wItem(i).toLowerCase() == myOption.toLowerCase()) //index found.
{
myControl.SetSelectedIndex(i);
found = true;
break;
}
}
if (! found)
{
Log.warning("Your selected item '" + myOption + "' does not exist.");
}
[/code]
Related Content
- 2 years agojaredjamieson
- 4 years agoMuralidhar
- 11 months agorstelly
- 3 years agodelito
Recent Discussions
- 3 days agoAndiiiA
- 3 days agomegha_phophalia
Log functions
Solved4 days agoAurore