Repeat script does not work

Peter Haworth pete at lcsql.com
Fri Oct 12 14:46:51 CDT 2012


I think you need to include the second repeat within the first repeat and
also fully qualify the references to button n, maybe something like this:

on mouseUp
   repeat with y = 1 to the number of cards of stack "xyz"
      if the mark of card y of stack "xyz"= true then
         put the number of buttons of card y of stack "xyz"into nbr
         repeat with n = 1 to nbr
            if the style of button n of card y of stack "xyz" is "checkbox"
and the hilite of button n of card y of stack "xyz" is true then
               put the uMyLabel of button n of card y of stack "xyz" into
tName
              put tName & cr after theList
            end if
         end repeat
      end if
   end repeat

   delete char -1 of theList
   put theList into field "recommendations"
end mouseUp

Pete
lcSQL Software <http://www.lcsql.com>



On Fri, Oct 12, 2012 at 12:20 PM, Charles Szasz <cszasz at me.com> wrote:

> The following script works for finding a checkbox that is checked and
> putting its custom property (uMyLabel) into the field "recommendations" on
> the marked card that it is on. However, it fails to put the uMyLabel of
> another checked checkbox that is on another marked card into the field
> "recommendations".  What am I missing here!
>
> on mouseUp
>    repeat with y = 1 to the number of cards
>       if the mark of card y = true then
>          put the number of buttons of card y into nbr
>       end if
>    end repeat
>
>    repeat with n = 1 to nbr
>       if the style of button n is "checkbox" and the hilite of button n is
> true then
>          put the uMyLabel of button n into tName
>          put tName & cr after theList
>       end if
>    end repeat
>    delete char -1 of theList
>    put theList into field "recommendations"
> end mouseUp
>
> Charles Szasz
> cszasz at mac.com
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list