How to edit a script with a script?

Ray Horsley ray at linkitonline.com
Sat Jan 7 15:45:59 CST 2006


Reinhold,

Try working with the variables instead literals.  That is, instead of 
using keywords like "then" as literals in your script, put them into 
variables and work with the variables.

Ray Horsley
Developer, LinkIt! Software
On Jan 7, 2006, at 3:05 PM, Reinhold Venzl-Schubert wrote:

> 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
>
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3939 bytes
Desc: not available
Url : http://mail.runrev.com/pipermail/metacard/attachments/20060107/f0b5f6ba/attachment.bin


More information about the metacard mailing list