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

Re: [Clip] How do I create a Replace clip to Increment with each Replacement?

Expand Messages
  • Jody
    Hi Jim, I think I have what you wanted below... ... They was a he, as in me. ... H=Replace abc In Open Docs ;
    Message 1 of 3 , Aug 18, 2004
    • 0 Attachment
      Hi Jim,

      I think I have what you wanted below...

      >I'm brand new to this NoteTab program.
      >Can someone please provide or point me to a Clip that will do
      >the following:
      >
      >(and by the way, this more of curiosity, than an immediate need)
      >I had directly emailed NoteTab's wonderful host, but I'm sure they
      >are overwhelmed, so I decided to try the group.

      They was a he, as in me. <g>

      >I need a Clip that will make replacements in all of my open
      >documents, regardless of how many I have, and with each
      >replacement, increment the value.

      <--- Copy below this line --->
      H=Replace abc In Open Docs
      ; Replaces search string with the string and incrementing numbers
      ; automatically pads the leading 0 (zero) for like 01-99, 001-999
      ; eMailed on 08-18-2004, ntb-clips@yahoogroups.com, Jody
      ; www.notetab.net, www.clean-funnies.com, www.sojourner.us
      ; Fookes Software Home via my affiliate link. Thank$ :)
      ; http://www.fookes.com/regnow.html?2448&item=home

      ^!Set %Find%=^?{Text preceding numbers}; %Num%=0; %Pad0%=0
      ; %NoAsk%=0
      ^!Document First
      ^!Jump 1

      :Loop
      ^!IfTrue ^%SkipCalcs% PadInc
      ^!Set %EndNum%=^$Calc(^$GetDocCount$+1)$
      ^!Set %SkipCalcs%=1
      ^!Set %Stop%=^$StrSize("^%EndNum%")$
      ^!Set %Zeros%=^$StrFill("0";^%EndNum%)$

      :PadInc
      ^!Set %Pad0%=^$StrCopyRight("^%Zeros%^%Num%";^%Stop%)$
      ^!Inc %Num%

      ^!Replace "^%Find%" >> "^%Find%^%Pad0%" RS
      ^!Document Next
      ^!Jump 1
      ^!If ^%Pad0% > ^$GetDocCount$ Next else Loop

      <--- Copy above this line --->
      <--- Right click over a Library --->
      <--- Choose: Add from Clipboard --->

      >Example:
      >
      >Say I have 10 (or however many) open .txt files. I happen to know
      >that each of these 10 text files has the string: ABC
      > Well, I want the Replace Clip to work this way: Replace the
      > first open txt document's ABC with ABC01, Replace the second
      > open txt file with ABC02, and so on, for how ever many of my
      > txt files I have open. Is that possible?

      Happy Clip'n!
      Jody

      www.clean-funnies.com, http://www.fookes.us/maillist.htm

      Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
      UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
      Options: http://groups.yahoo.com/group/ntb-clips
    Your message has been successfully submitted and would be delivered to recipients shortly.