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

21688Re: [Clip] Find Links to "Nonstandard" CSS files

Expand Messages
  • Axel Berger
    Apr 2, 2011
      Ray Shapp wrote:
      > There are at least two issues here: how to write the Regex, and
      > how to pipe the output from file search into a text file.

      For both I can reuse things I've done before. <Ctrl><D> won't suffice,
      you'll have to loop through and open all your files. The loop is
      something I reuse often. The top adaptation block need not be altered,
      it just makes the follwing wizards quicker to use, if they're already
      pointed in the right direction. The inner adaptation is your current
      task.

      There are two ways of loading CSS that I use, so the first Find looks
      for both. An error means there's no CSS and we can move on to the next
      file. The second find checks the found (and highlighted) .css id it's
      one of your standard ones. If yes (no error) there may be more CSS files
      loaded so search on. If not this is one of the files you're looking for,
      so add it to the list and move on to the next file.

      The clip is not tested but ought to work:



      ; Adapt this part to the task in hand
      ^!Set %varFIL%="F:\Webspace\index.php"
      ^!Set %varPAT%="*.htm*"
      ; End of individual adaptation

      ^!SetWizardLabel "Please define the files to be converted"
      ;^!SetDebug On
      ; Long line start
      ^!Set %varFIL%=^?{(T=O;F="Source
      Files|*.html;*.htm;*.?html;*.xml;*asp;*.css;*.php;*.php3;*.php4")Sample
      file=^%varFIL%}; %varSDR%=^?{(T=L)Include Subdirectories?==_Yes|No};
      %varPAT%=^?{Search Pattern=^%varPAT%}
      ; Long line end
      ^!Set %varPTH%=^$GetPath(^%varFIL%)$
      ^!If "^%varSDR%"="Yes" yessub ELSE nosub
      :yessub
      ^!Set %varFIL%=^$GetFileFirst("+^%varPTH%";"^%varPAT%")$
      ^!Goto loop
      :nosub
      ^!Set %varFIL%=^$GetFileFirst("^%varPTH%";"^%varPAT%")$
      :loop
      ^!IfTrue ^$IsEmpty(^%varFIL%)$ finished
      ;^!Continue ^%varFIL%
      ^!Open "^%varFIL%"

      ; Adapt this part to the task in hand

      ^!Jump TEXT_START
      :more
      ^!Find "(url\(.+\.css\);|HREF=".+\.css">)" RASTI
      ^!IfError done
      ^!Find "(plain_black\.css|ccars\.css)" HRASTI
      ^!IfError NEXT ELSE more
      ^!AppendToFile "E:\Temp\00A.htm" ^$GetDocName$

      ; End of individual adaptation

      :done
      ^!Close ALL
      ^!Set %varFIL%=^$GetFileNext$
      ^!Goto loop
      :finished
      ^!CloseFileFind




      Axel
    • Show all 6 messages in this topic