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

Re: [Clip] Processing directory of files: Need Advice

Expand Messages
  • Jody
    Hi Alan, ... It s hard for me tell exactly what you are doing, but I will comment on the following two lines first. ... Don t put the brackets around your
    Message 1 of 3 , May 3, 2000
    • 0 Attachment
      Hi Alan,

      > Im trying to write a clip that will open each file in a
      > directory, insert a file at a marker, do a find and replace
      > using regular expression (am unable to get it to be non-greedy
      > or whatever).

      It's hard for me tell exactly what you are doing, but I will
      comment on the following two lines first.

      >^!Replace "<!--.*--> " >> "??" [IRA]

      Don't put the brackets around your options. The brackets in Help
      are only there to tell you the options are optional.

      >^!Replace "<!--.*--> " >> "??" [IRA] Goto Loop

      Goto Loop needs to be on its own line:

      ^!Goto Loop

      You seem to know enough to modify this to fit your needs, but
      perhaps you can just use the RegExp in Search Disk to do what you
      need.

      Find whatever and Replace with: <!--[^>]*-->

      That will select everything between the open/end arrows and not
      go to the next, as in only the abc comment below and then the def.

      <!-- abc --> <!-- def -->

      <--- Copy below this line --->
      H=OpenDir-RegExp-G
      ; Last Updated 05/03/2000, Sojourner@..., jody
      ; Requires NoteTab v4.81
      ; http://www.sureword.com/notetab

      ^!ClearVariables

      ; long line till blank line
      ^!Set %Folder%=^?{(T=D)Full path, end in backslash=E:\NoteTab Pro\Test\}; %Type%=^?{File &Type=*.htm*}; %Sort%=^?{&Sort order=Date|_Name|Size|Type|UnSorted}

      ^!SetHintInfo Opening Files...

      ^!SetListDelimiter ^p
      ^!SetArray %OpenList%=^$GetFiles("^%Folder%";^%Type%;^%Sort%)$
      ^!Set %Count%=^%OpenList0%
      ^!Set %Index%=0
      ^!Set %OpenCount%=0

      :OpenLoop
      ^!SetScreenUpdate Off
      ^!Inc %Index%
      ^!If ^%Index% > ^%Count% Replace
      ^!IfTrue ^%FileCnt% Skip
      ^!Open ^%OpenList^%Index%%
      ^!Goto OpenLoop

      :Replace
      ; change the replace side
      ^!Replace "<!--[^>]*-->" >> "<!-- www.sureword.com/notetab -->" WATIRSG
      ^!IfError End

      <--- Copy above this line, right --->
      <--- click over a Library, and --->
      <--- choose "Add from Clipboard" --->

      Happy Clip'n!
      Jody

      http://www.sureword.com/notetab

      Subscribe, UnSubscribe, Options
      mailto:Ntb-Clips-Subscribe@...
      mailto:Ntb-Clips-UnSubscribe@...
      http://www.egroups.com/list/ntb-clips
    • Jody
      Hi Alan, ... Reverse that please. :) Find ]*-- and replace with... nite... c ya, Jody The whole world doth err save you and me and even thou doest err
      Message 2 of 3 , May 3, 2000
      • 0 Attachment
        Hi Alan,

        >Find whatever and Replace with: <!--[^>]*-->

        Reverse that please. :)

        Find <!--[^>]*--> and replace with...

        nite...

        c ya,
        Jody

        The whole world doth err save you
        and me and even thou doest err some!

        http://www.sureword.com/sojourner
      Your message has been successfully submitted and would be delivered to recipients shortly.