Page 1 of 1

Iterating over objects in a group?

Posted: Wed Jan 20, 2010 6:55 am
by massung
Sorry if this is covered somewhere, but I've been looking and can't seem to find it. What I'd like to do is send a message to all the objects in a group. For example (pseudo code):

Code: Select all

command savePrefs
   get objects in group "GroupName"

   repeat for each line tLongID in it
      send "savePrefs" to tLongID
   end repeat
end savePrefs
Just curious if this is doable somehow?

Thanks!

Jeff M.

Re: Iterating over objects in a group?

Posted: Wed Jan 20, 2010 7:37 am
by sturgis
YOu can do something like this:

Code: Select all

on mouseUp
   repeat with i = 1 to the number of controls in group "myGroup"
     put the long id of control i of group "myGroup" into tId
     send savePrefs to tId 
   end repeat
end mouseUp


command savePrefs
     --    save your prefs here
end savePrefs