Find Child Loop Statement
Hey Guys,
I'm stuck on a pretty interesting problem and I was wondering if you could help me out. I basically think I'm having a syntax issue with the findchild statement.
I want to create a for loop that will click each button in a toolbar. The buttons are identified with this "Name" property:
SwingObject("MJButton", "", 1)
then the next button is:
SwingObject("MJButton", "", 2)
Each button is incremented by 1. With this in mind, I want to put together a for loop:
for(var i=1;i<=numberOfChildren;i++)
{
var Btn = toolBar.FindChild('Name', 'SwingObject("MJButton", "", i)', 2)
Sys.HighlightObject(Btn,3)
}
And this is where I'm stuck. Because I have "i" declared in a string, its not being seen as a increment so nothing happens when the statement is executed. Reading the FindChild documentation and examples, it seems like object properties have to be declared as strings.
is there a correct way to write the 'SwingObject("MJButton", "", i)' statement?
Much appreciated !
Hi,
var Btn = toolBar.FindChild('Name', aqString.Format('SwingObject("MJButton", "", %i)', i), 2)
Does this help?