Page 1 of 1

each keyword for buttons

Posted: Thu Jun 07, 2012 1:53 pm
by snm
Is it possible to repeat the script step for each button grouped in group?
For example:

Code: Select all

repeat for each btw theButton in grp "myGroupOfButtons"
  do something
end repeat
Marek

Re: each keyword for buttons

Posted: Thu Jun 07, 2012 2:18 pm
by Klaus
Hi Marek,

no, "for each..." only works with chunk expressions like "line", "word" etc.
I wish it would also work with objects like cards and buttons etc.

You need to loop through "the num of btns of grp XYZ" in this case.


Best

Klaus

Re: each keyword for buttons

Posted: Thu Jun 07, 2012 2:19 pm
by sturgis
Nope, don't believe you can use for each with buttons or any type of controls unless you keep a list of the buttons yourself at which point you can

repeat for each line tLine in myGroupedButtonList

In this case the easiest way is with an i = 1 to the number of buttons in group "groupname"

Code: Select all

repeat with i = 1 to the number of buttons in group "mygroup"
    put the name of button i of group "mygroup" after field 1
end repeat

Re: each keyword for buttons

Posted: Thu Jun 07, 2012 2:27 pm
by snm
Thanks a lot Klaus and Strugis.

Marek