Hi Kay, Jim, etc.,

Would something like the following work? I find the one liner very confusing; Hard to see exactly what is being merged. The brackets (square) seem to melt everything into a confusing mess, but separating each item that is being merged onto a separate line makes it very readable.

put merge("\
[[the short name of the target]]_\
[[word 1 of the clickline]]\
")\ --end merge
into gStartHere --The destination of the string

It would also be conducive to a form whereby if one typed the phrase "merge 3", the script editor could replace it with a skeleton something like:

put merge("\
[[ ]]\
[[ ]]\
[[ ]]\
")\
into    --The destination of the string

Which can easily be completed. Does this make sense? Since I have yet to look at the documentation on "merge", this may be foolish.

Joe Wilkins


On Mar 11, 2007, at 6:16 PM, Kay C Lan wrote:

On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

put word 1 of the clickLine into tWhichLine
put ( tWhichField & "_" & tWhichLine) into gStartedHere

rather than

put (the short name of the target & "_" & word 1 of the clickLine) into
gStartedHere


Jim put me onto the 'merge()' function, check it out in the docs. Actually I'm surprised it hasn't already mentioned here as it pretty well eliminates
the need for & or && in most cases.

put merge("[[the short name of the target]]_[[word 1 of the clickLine]]")
into gStartedHere

As for the initial problem, I wouldn't use merge() for this but it could be:
put merge("[[quote]][[lineNum]]H[[quote]]") into fldName

When initially used the double square brackets can be a little confusing but
once you're use to it it can make code more readable and compact.

put "Name1:" & tab & var1 & "." & cr \
   & "Name2:" & tab & var2 & "." & cr \
   etc etc
   & "Name10:" & tab & var10 & "." \
   into field "listsVars"

put merge("Name1:[[tab]][[var1]].[[cr]] \
          Name2:[[tab]][[var2]].[[cr]] \
          etc etc
          Name10:[[tab]][[var10]].") \
          into field "listsVars"

I generally find it easiest to just write it the way I want it (no spaces
unless required), then put the square brackets around what needs to be
evaluated into a string:

Namea:tabvara.cr
Name[[a]]:[[tab]]var[[a]].[[cr]]

Of course the other beauty of merge() is that merge() inside a merge()
allows you to build dynamic variables and evaluate them, such as in a repeat
loop. The following does the same as above, just a lot less code.

repeat for each item a in listOfTen
put merge("Name[[a]]:[[tab]][[" & merge("[[var&a]]") & "]].[[cr]]") after
field "listsVars"
end repeat

HTH
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to