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

16644Re: [Clip] Re: Creation of clip

Expand Messages
  • Don - HtmlFixIt.com
    Jun 19, 2007
      Ok that was not right ... try this one instead ...

      ;clip to remove lines that do contain keywords
      ;keywords go in a file with one keyword per line
      ;start with the file to be parsed open
      ;whacked at by don at htmlfixit dot com
      ;used regex proposed by pat

      ;long line follows
      ^!Set %Keywords%=^?{(T=O;F="Textfiles (*.txt)|*.txt")Choose Keyword File:}
      ;long line preceeds
      ^!Set %Doc%=^$GetDocIndex$

      ^!Open ^%Keywords%
      ; Remove empty lines in keyword list
      ^!Replace "(\r\n){2,}" >> "\r\n" AWRS
      ; Put keywords into alternation
      ^!Replace "\r\n" >> "|" AWRS
      ; Remove "empty alternation" at list end
      ^!Replace "\|\Z" >> "" AWRS
      ^!Select All
      ^!Set %Search%=^$GetSelection$
      ^!Close Discard

      ;be sure we are back on proper document
      ^!SetDocIndex ^%Doc%
      ^!SetWordWrap Off
      ^!Jump Doc_Start

      ^!Select Eol
      ^!Find ".*(^%Search%).*" TIHRS
      ;this deletes line if contains keyword
      ^!IfError Continue
      ^!InsertText ^%EMPTY%
      ^!Goto Loop

      ;finish if end of file is reached
      ^!If ^$GetRow$ = ^$GetLinecount$ Finish
      ;this moves to next line if keyword not found
      ^!Jump +1
      ^!Goto Loop

      ;clean up any empty line(s) at start if exist(s)
      ^!Jump Doc_Start
      ^!Select Eol
      ^!If "^$GetSelection$" <> "" EmptyLinesOut
      ^!SelectTo 2:1
      ^!InsertText ^%EMPTY%
      ^!Goto Finish

      ;clean out all empty lines after deletion
      ^!Replace "^P^P" >> "^P" ACIWS
      ^!IfError End
      ^!Goto EmptyLinesOut
    • Show all 30 messages in this topic