Loading ...
Sorry, an error occurred while loading the content.

Re: Oh Dear, trying a supposedly simple script

Expand Messages
  • maxgrenkowitz
    Thank you Hugo, Spot on! This is what I needed. ; Go to start of doc ^!Jump 1 ... ; Select until end of line ^!Select EOL ^!Set %Word%=^$GetSelection$ ; This
    Message 1 of 6 , Jun 22, 2004
    • 0 Attachment
      Thank you Hugo,

      Spot on!
      This is what I needed.

      ; Go to start of doc
      ^!Jump 1
      :SELECTLINE
      ; Select until end of line
      ^!Select EOL

      ^!Set %Word%=^$GetSelection$

      ; This replaces the first word with the same one
      ^!InsertText ^!Replace "^%WORD%" >> "^%Word%$" WASI

      ; This tells NT to stop if it reaches the last line
      ^!If ^$GetTextLineCount$=^$GetRow$ EXIT

      ; If not (yet) at the last line: go to the next line and
      ^!Jump +1
      ; ... do the same thing again
      ^!GoTo SELECTLINE

      What may have confused you in my earlier postings is that I use
      comments BEFORE executing commands :)

      I have a list like this:
      xproductdisplaysavingminpercent
      xproductdisplaysavingoffamount
      xproductdisplaybestprice
      xproductdisplaybestpricepercent


      That needs to turn into this:
      xProductDisplaySavingMinPercent
      xProductDisplaySavingOffAmount
      xProductDisplayBestPrice
      xProductDisplayBestPricePercent

      I modify the upper/lower casing of these variable names manually,
      and then need the REPLACE to go around it.

      Because I use WASI as REPLACE parameter, this is why I need only a
      copy of the first work, without any modifications.

      Thank you kindly again!!

      Cheers,
      Max





      --- In ntb-clips@yahoogroups.com, "Hugo Paulissen"
      <hugopaulissen@s...> wrote:
      > Max,
      >
      > I do not know if this is of any help, but this is a clip that
      > replaces the word on a line with the ^!Replace line. It is an
      attempt
      > to make something as you described. The problem (for me) is that I
      do
      > not really understand 1. the goal of the clip and 2. the
      difference
      > between the original words and the replacement-words...
      >
      > Be careful though: I guess you copy the result to a clip
      afterwards,
      > do not run this clip in an open clip-doc.
      >
      > Beware of long lines...
      >
      > Hugo
      >
      > ^!Jump 1
      > ; Go to start of doc
      > :SELECTLINE
      > ^!Select EOL
      > ; Select until end of line
      > ^!Set %Word%=^$GetSelection$
      > ; Create Variable Word and put the selection into it
      > ; -----------------------------
      > ; ALTERNATIVE 1 - is active now
      > ^!InsertText "^!Replace "^%WORD%" >> "^?{Replace ^%Word% with?=}"
      > WASI"
      > ; Replace the word with the replace-line, you're being prompted
      > ; for the replacement text, since I do not know what that should
      be...
      > ; -----------------------------
      > ; ALTERNATIVE 2 - not active now
      > ;^!InsertText "^!Replace "^%WORD%" >> "^$StrCapitalize("^%Word%")
      $"
      > WASI"
      > ; This replaces the first word with the same one, capitalized
      > ; -----------------------------
      > ^!If ^$GetTextLineCount$=^$GetRow$ EXIT
      > ; This tells NT to stop if it reaches the last line
      > ^!Jump +1
      > ; If not (yet) at the last line: go to the next line and
      > ^!GoTo SELECTLINE
      > ; ... do the same thing again
    Your message has been successfully submitted and would be delivered to recipients shortly.