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

GetFileFirst

Expand Messages
  • paulmaser
    ^$GetFileFirst(FilePath;FileSpecs[;SortingOrder])$ I ve been using this command in a script for several years using REVNAME for the sorting order. Recently, it
    Message 1 of 5 , May 29, 2007
    • 0 Attachment
      ^$GetFileFirst(FilePath;FileSpecs[;SortingOrder])$

      I've been using this command in a script for several years using
      REVNAME for the sorting order. Recently, it doesn't reverse the sorting
      order but gives back the same result as using NAME for the sort order.
      Here is the line from the script:

      ^!Set %LastFilePath%=
      ^$GetFileFirst(D:\web\nuraste\;nn1*.htm;REVNAME)$

      Does anyone see a reason it might not like what I am doing?

      Thanks.
    • abetsent
      Friends, I never used GetFileFirst. Any time I need a loop to do anything, I create a DIR of his directory, create a counter and ^!Inc, and do anything in any
      Message 2 of 5 , May 3, 2009
      • 0 Attachment
        Friends,

        I never used GetFileFirst. Any time I need a loop to do anything, I create a DIR of his directory, create a counter and ^!Inc, and do anything in any file, one per one. As are standard in most codes.

        However, appears to me that the GetFileFirst do the same thing, I am not sure. If yes, please kindly suggest an example:

        Let's say that I have the directory c:\example\ with a lot of .htm files. I want to pickup one per one, do something, and finishing after the last file in the c:\example\ directory. As a standart loop, etc.

        The GetFileFirst is better than the old loop type, as I use?

        Please help!

        C Brito
      • 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 3 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 4 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 5 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.