How do I change the script for 100 buttons in one time?

Andre.Bisseret Andre.Bisseret at inria.fr
Fri Mar 5 04:23:57 EST 2010


Bonjour,

I suggest a mix of Jacques' and Jim ' scripts
and addition of a line to eliminate the current scripts of the 100  
buttons

  on changeScripts
    --put fld "newScript" into baseScript
    repeat with k = 1 to the number of cards
       repeat with m = 1 to the number of btns in cd k
          get word 1 of the short name of btn m of cd k
          if char 1 of IT = "d" and char 2 to -1 of IT < 101 then
             set the behavior of btn m of cd k to the long ID of  
button "BCommonscript" of cd 1
             set the script of btn m of cd k to empty -- clean the  
script of the button
          end if
       end repeat
    end repeat
end changeScripts

Best regards from Grenoble

André

Le 4 mars 10 à 20:25, Jim Ault a écrit :

> Yours is the best solution, Jacques, if using Rev 3.0 or later.
> Repeat loops will work on all versions 2.2+
>
> Jim Ault
> Las Vegas
>
>
> On Mar 4, 2010, at 11:05 AM, Jacques Hausser wrote:
>
>> Hi William
>>
>> A good case for using behaviors ! Set the script of an hidden btn  
>> "BCommonScript" as you want and then put somewhere in the opening  
>> process of your stack:
>>
>> repeat with i = 1 to 100
>>  put "d" &i into tButtonName
>>  set the behavior of btn tbuttonName to the long ID of button  
>> "BCommonscript"
>> end repeat
>>
>> Jacques
>>
>> Le 4 mars 2010 à 19:46, William de Smet a écrit :
>>
>>> Hi there,
>>>
>>> I have a stack with 100 buttons in it and they all have the same  
>>> script.
>>> The buttons are called "d1" to "d100".
>>>
>>> How do I change the code for all of them in one time?
>>> I don't feel like copy/paste 100 times.
>>>
>>
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution






More information about the use-livecode mailing list