How to edit a script with a script?

Ken Ray kray at sonsothunder.com
Mon Jan 9 14:11:38 CST 2006


On 1/9/06 12:13 PM, "Huisingh, Larry R" <Larry_R_Huisingh at RL.gov> wrote:


> One solution is to use special methods to embed quotes in your string.
> Use something like this
>     add CR & "on mousedown" & CR & "if the visible of btn " & quote &\
>         "Krtgeaendert" & quote & " then" & CR & "grab me" & CR & "end
> if" &\
>         CR & "end mousedown" to ScriptMerk
> 
> Note the use of the constant named "quote".  It is the equivalent to
> NumToChar(34).  There may be other methods but this one should work.

True... Here's a couple of other methods:

(NOTE: You can't use "add" to put strings together; "add" is for addition.)

1) Use backquotes for placeholders, and replace them later with regular
quotes:

  put ScriptMerk & CR & "on mousedown" & CR & \
    "if the visible of btn `Krtgeaendert` then" & CR &
    "grab me" & CR & "end if" & CR & "end mousedown" into ScriptMerk
  replace "`" with quote in ScriptMerk

2) Use the format() function, which lets you embed quotes in a string as \"
and CRs as \n:

  put ScriptMerk & format("\non mousedown\n") & \
    format("if the visible of btn \"Krtgaendert\" then") & \
    format("\ngrab me\nend if\nend mousedown") into ScriptMerk

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com



More information about the metacard mailing list