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

Re: [Clip] GetFileFirst

Expand Messages
  • Axel Berger
    ... It allows you to choose only certain files with given name patterns without copying them first. I have a prepared frame for multi-file changes that uses
    Message 1 of 5 , May 3, 2009
    • 0 Attachment
      abetsent wrote:
      > The GetFileFirst is better than the old loop type, as I use?

      It allows you to choose only certain files with given name patterns
      without copying them first. I have a prepared frame for multi-file
      changes that uses it. It is commented a lot, because I use it very
      rarely and need to be reminded of how it works

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

      ^!SetWizardLabel "Please define the files to be converted"
      ;^!SetDebug On
      ; --> long line follows
      ^!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 ends
      ^!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

      ^!Replace "http://www.w3.org/Icons/valid-html401" >>
      "http://berger-odenthal.de/pics/valid-html401.png" WAS
      ^!Replace "http://jigsaw.w3.org/css-validator/images/vcss" >>
      "http://berger-odenthal.de/pics/vcss.png" WAS

      ; --> long line follows
      ;^!Replace "//EN"> <" >> "//EN"^P
      "http://www.w3.org/TR/html4/loose.dtd">^P<" WAS
      ; --> long line ends

      ; End of invidual adaptation

      ^!Close ALL,SAVE
      ^!Set %varFIL%=^$GetFileNext$
      ^!Goto loop
      :finished
      ^!CloseFileFind
      > ------------------------------------

      Hope this helps

      Axel
    • abetsent
      Dear Axel, THANKS! I picked some codes that you showed, and used in my case: ^!Set %varFIL%=^$GetFileFirst( c: a_provis ; *.htm )$ ... ^!IfTrue
      Message 2 of 5 , May 3, 2009
      • 0 Attachment
        Dear Axel, THANKS!

        I picked some codes that you showed, and used in my case:

        ^!Set %varFIL%=^$GetFileFirst("c:\a_provis";"*.htm")$
        :loop
        ^!IfTrue ^$IsEmpty(^%varFIL%)$ finished

        ; DO SOMETHING ------------------
        ^!Open ^%varFIL%
        ^!StatusShow DO SOMETHING ^%varFIL%
        ^!Delay 10
        ; discard are only for test
        ^!Close ^%varFIL%,discard
        ; END DO SOMETHING -------------------

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

        Naturally, is running. But I have a last question: This are (code view) correct?

        Yes, is better than my old loop control.

        Best regards,
        C Brito




        --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
        >
        > abetsent wrote:
        > > The GetFileFirst is better than the old loop type, as I use?
        >
        > It allows you to choose only certain files with given name patterns
        > without copying them first. I have a prepared frame for multi-file
        > changes that uses it. It is commented a lot, because I use it very
        > rarely and need to be reminded of how it works
        >
        > > ------------------------------------
        > ; Adapt this part to the task in hand
        > ^!Set %varFIL%="F:\Webspace\index.php"
        > ^!Set %varPAT%="*.htm;*.php"
        > ; End of invidual adaptation
        >
        > ^!SetWizardLabel "Please define the files to be converted"
        > ;^!SetDebug On
        > ; --> long line follows
        > ^!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 ends
        > ^!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
        >
        > ^!Replace "http://www.w3.org/Icons/valid-html401" >>
        > "http://berger-odenthal.de/pics/valid-html401.png" WAS
        > ^!Replace "http://jigsaw.w3.org/css-validator/images/vcss" >>
        > "http://berger-odenthal.de/pics/vcss.png" WAS
        >
        > ; --> long line follows
        > ;^!Replace "//EN"> <" >> "//EN"^P
        > "http://www.w3.org/TR/html4/loose.dtd">^P<" WAS
        > ; --> long line ends
        >
        > ; End of invidual adaptation
        >
        > ^!Close ALL,SAVE
        > ^!Set %varFIL%=^$GetFileNext$
        > ^!Goto loop
        > :finished
        > ^!CloseFileFind
        > > ------------------------------------
        >
        > Hope this helps
        >
        > Axel
        >
      • Axel Berger
        ... Looks alright to me. Axel
        Message 3 of 5 , May 3, 2009
        • 0 Attachment
          abetsent wrote:
          > This are (code view) correct?

          Looks alright to me.

          Axel
        Your message has been successfully submitted and would be delivered to recipients shortly.