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

      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
      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
      ^!Set %varFIL%=^$GetFileFirst("+^%varPTH%";"^%varPAT%")$
      ^!Goto loop
      ^!Set %varFIL%=^$GetFileFirst("^%varPTH%";"^%varPAT%")$
      ^!IfTrue ^$IsEmpty(^%varFIL%)$ finished
      ;^!Continue ^%varFIL%
      ^!Open "^%varFIL%"

      ; Adapt this part to the task in hand

      ^!Jump TEXT_START
      ^!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

      ^!Close ALL
      ^!Set %varFIL%=^$GetFileNext$
      ^!Goto loop

    • Show all 6 messages in this topic