How to edit a script with a script?

Reinhold Venzl-Schubert R.Venzl-Schubert at t-online.de
Sat Jan 7 14:05:51 CST 2006


Hi!

I have a stack "Karten" with a lot of cards and a lot of images  
(BiFra1, BiFra2, BiFra3, ... ,BiFra20).
I want to move the images with the mouse. Therefore I will add the  
following lines to the scripts of the images:

on mousedown
   if the visible of btn "Krtgeaendert" then  # Krtgeaendert means  
"card is changed". This button is visible when the user is changing  
the cards
     grab  
me                                                                  #  
and it stopps the changing. Only in changing-mode it shall be  
possible to drag the image to another position.
   end if
end mousedown

Because I don't want to change each script manually I created a  
little stack and a button with this script:

on mouseUp
   global ScriptMerk
   go stack "Karten"
   repeat with i = 1 to 20
     if there is a img ("BiFra" & i) then
       put the script of img ("BiFra" & i) into ScriptMerk
       if "on mousedown" is not among the lines of ScriptMerk then
         add CR & "on mousedown" & CR & "if the visible of btn  
"Krtgeaendert" then" & CR &\
            "grab me" & CR & "end if" & CR & "end mousedown" to  
ScriptMerk
       set the script of img ("BiFra" & 1) to ScriptMerk
       edit the script of img ("BiFra" & i)
      end if
    end if
   end repeat


But when I try to apply the script I get the Script Error:

if: not a command
if: error in command

Metacard is grumbling about the word Krtgeaendert.
It understand it as a command, because it follows a behind the second  
quotation mark.
In what way can I put the name of a button in a script?

Thanks
Reinhold


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.runrev.com/pipermail/metacard/attachments/20060107/54cb58f1/attachment.html


More information about the metacard mailing list