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

[Clip] Re: Using ^$GetFileFirst

Expand Messages
  • Wayne VanWeerthuizen
    ... Something like this: (It is fairly short. The comments make it longer.) H= File listing into an Array ;Clear variable before using ^!Append.
    Message 1 of 9 , Apr 1, 1999
      "Norma Armstrong" <narmstr@...> wrote:

      >How can I use ^$GetFileFirst to return a list of files and insert them in an
      >array
      >so I can process multiple files? I'm kind of confused on how to go about
      >that. I see there's a ^GetFileNext$. Basically I'm working on a clip to
      >convert IE Favorites to an html file. I got everything but the actual loop
      >to do the work. Any ideas?

      Something like this: (It is fairly short. The comments make it longer.)


      H="File listing into an Array"

      ;Clear variable before using ^!Append.
      ^!ClearVariable %FileList%

      ;Get first file.
      ^!Set %ThisFile%=^$GetFileFirst("C:\";"*.*";NAME)$
      ^!IfTrue ^$IsEmpty(^%ThisFile%)$ Done
      ^!Append %FileList%=""^%ThisFile%""
      ; Outer quotes used by append.
      ; Inner quotes put into variable.

      ;Get remaining files.
      :Loop
      ^!Set %ThisFile%=^$GetFileNext$
      ^!IfTrue ^$IsEmpty(^%ThisFile%)$ EndLoop
      ^!Append %FileList%=";"^%ThisFile%""
      ; Doubled quotes intentional.
      ^!Goto Loop
      :EndLoop

      ;At this point we do not HAVE to make the list into
      ;an array. This works ok without being an array.
      ;^!Open ^%FileList%

      ;Put into an array
      ^!SetArray %FileArray%=^%FileList%
      ; Putting them into an array puts the count
      ; of the number of files into ^%FileArray0%
      ; The N-th file is in ^%FileArray^%N%%

      ;Diagnostic Output
      ^!Info Items=^%FileArray0%^p^p^%FileArray%



      ------------------------------------------------------------------------
      eGroup home: http://www.eGroups.com/list/ntb-clips
      Free Web-based e-mail groups by eGroups.com
    • Norma Armstrong
      ... [Clip code snipped to make message shorter] Thanks for the code. It s well appreciated! To save bandwidth a big thanks to Jody too! :) Norma ... eGroup
      Message 2 of 9 , Apr 1, 1999
        > -----Original Message-----
        > From: Wayne VanWeerthuizen [mailto:wayne@...]
        > Sent: Thursday, April 01, 1999 1:46 PM
        > To: ntb-clips@egroups.com
        > Subject: [Clip] Re: Using ^$GetFileFirst
        >
        >
        > "Norma Armstrong" <narmstr@...> wrote:
        >
        > >How can I use ^$GetFileFirst to return a list of files and
        > insert them in an
        > >array

        >
        > Something like this: (It is fairly short. The comments make it longer.)
        >
        >
        [Clip code snipped to make message shorter]

        Thanks for the code. It's well appreciated! To save bandwidth a big thanks
        to Jody too! :)
        Norma


        ------------------------------------------------------------------------
        eGroup home: http://www.eGroups.com/list/ntb-clips
        Free Web-based e-mail groups by eGroups.com
      • Wayne VanWeerthuizen
        ... Last line here should be: ^!IfTrue ^$IsEmpty(^%ThisFile%)$ EndLoop ... eGroup home: http://www.eGroups.com/list/ntb-clips Free Web-based e-mail groups by
        Message 3 of 9 , Apr 1, 1999
          wayne@... (Wayne VanWeerthuizen) wrote:

          >"Norma Armstrong" <narmstr@...> wrote:
          >
          >>How can I use ^$GetFileFirst to return a list of files and insert them in an
          >>array
          >>so I can process multiple files? I'm kind of confused on how to go about
          >>that. I see there's a ^GetFileNext$. Basically I'm working on a clip to
          >>convert IE Favorites to an html file. I got everything but the actual loop
          >>to do the work. Any ideas?
          >
          >Something like this: (It is fairly short. The comments make it longer.)
          >
          >;Get first file.
          >^!Set %ThisFile%=^$GetFileFirst("C:\";"*.*";NAME)$
          >^!IfTrue ^$IsEmpty(^%ThisFile%)$ Done

          Last line here should be:
          ^!IfTrue ^$IsEmpty(^%ThisFile%)$ EndLoop


          ------------------------------------------------------------------------
          eGroup home: http://www.eGroups.com/list/ntb-clips
          Free Web-based e-mail groups by eGroups.com
        • Jody
          Hi Norma and Eric, Eric, Sort order is not working in ^$GetFileFirst(^%Path%;^%Ext%;^%Sort%)$ for Type. Name is working; I did not check the others. I checked
          Message 4 of 9 , Apr 1, 1999
            Hi Norma and Eric,

            Eric,

            Sort order is not working in ^$GetFileFirst(^%Path%;^%Ext%;^%Sort%)$
            for Type. Name is working; I did not check the others. I checked
            your Image to HTML out to see what I was doing wrong and it no workie
            there either. :(

            >How can I use ^$GetFileFirst to return a list of files and
            >insert them in an array so I can process multiple files?

            Here is another that may give you some ideas.

            H=FileList Checkbox
            ^!ClearVariable %DiskFileList%
            ^!ClearVariable %Nag%
            ^!SetHintInfo Getting Filenames...

            ; One lo...ng line :) Enter your own default path.

            ^!Set %Path%=^?[(T=D)Directory to search=H:\MySites\Sojourner\]; %Ext%=^?[(H=15)File Types==_All Files^=*.*|Images, Html, Midi, and Wav^=*.gif;*.jpg;*.*htm*;*.mid;*.wav|Images and Html Only^=*.gif;*.jpg;*.*htm*|Images Only^=*.gif;*.jpg|Html Only^=*.*htm*|Text only^=*.txt|Midi Only^=*.mid|Wav Only^=*.wav|Zip Files^=*.zip|MS Word Documents^=*.doc|Executables^=*.exe]; %Sort%=^?[Method to sort files=Unsorted|Name|_Type|Date|Size]

            ^!Set %Full%=^$GetFileFirst(^%Path%;^%Ext%;^%Sort%)$

            :Loop1
            ^!IfTrue ^$IsEmpty(^%Full%)$ CloseFind
            ^!Set %Name%=^%Full%

            ; Take out underscore "=_^%Name%" to have boxes unchecked

            ^!Append %DiskFileList%=_^%Name%|
            ^!Set %Full%=^$GetFileNext$
            ^!Goto Loop1

            :CloseFind
            ^!CloseFileFind

            ; Change any of the below for final ouput, adjust
            ; ^!Append %DiskFileList%=^%Name%| above accordingly. Next
            ; line is without an ^!Array ^!^?{(T=A;H=28)==^%DiskFileList%}
            ; and the clip would stop here if used.

            ^!SetArray %FileList%=^?{(T=A;H=28)==^%DiskFileList%}
            ^!Set %List%=^%FileList0%
            ^!Set %n%=0

            ^!SetWizardLabel Opens file with default application
            ; Long line.
            ^!Goto ^?{Yeppers, another nag screen==Prompt for each file^=Loop2|_Open All^=Loop3}

            :Loop2
            ^!Inc %n%
            ^!If ^%n% > ^%List% End
            ^!Skip Open ^%FileList^%n%%
            ^!Goto Loop2
            ^!^%FileList^%n%%
            ^!Goto Loop2

            :Loop3
            ^!Inc %n%
            ^!If ^%n% > ^%List% End
            ^!^%FileList^%n%%
            ^!Goto Loop3


            C ya,
            Jody

            http://www.sureword.com/sojourner
            http://www.sureword.com/notetab

            ------------------------------------------------------------------------
            eGroup home: http://www.eGroups.com/list/ntb-clips
            Free Web-based e-mail groups by eGroups.com
          • Jody
            Hi Norma and Anybody Reading, ... ; Change any of the below for final ouput, adjust ; ^!Append %DiskFileList%=^%Name%| above accordingly. ; Next line is
            Message 5 of 9 , Apr 1, 1999
              Hi Norma and Anybody Reading,

              This should have been as below:
              >; Change any of the below for final ouput, adjust
              >; ^!Append %DiskFileList%=^%Name%| above accordingly. Next
              >; line is without an ^!Array ^!^?{(T=A;H=28)==^%DiskFileList%}
              >; and the clip would stop here if used.

              ; Change any of the below for final ouput, adjust
              ; ^!Append %DiskFileList%=^%Name%| above accordingly.
              ; Next line is without an ^!Array
              ; ^!^?{(T=A;H=28)==^%DiskFileList%}
              ; and the clip would stop here if used.

              C ya,
              Jody

              http://www.sureword.com/sojourner
              http://www.sureword.com/notetab

              ------------------------------------------------------------------------
              eGroup home: http://www.eGroups.com/list/ntb-clips
              Free Web-based e-mail groups by eGroups.com
            • Wayne VanWeerthuizen
              ... After this point, there really should be a ^!CloseFileFind Bad of me to have forgotten that. ... eGroup home: http://www.eGroups.com/list/ntb-clips Free
              Message 6 of 9 , Apr 1, 1999
                wayne@... (Wayne VanWeerthuizen) wrote:

                >H="File listing into an Array"

                ...lines skipped...

                >^!Goto Loop
                >:EndLoop

                After this point, there really should be a ^!CloseFileFind

                Bad of me to have forgotten that.



                ------------------------------------------------------------------------
                eGroup home: http://www.eGroups.com/list/ntb-clips
                Free Web-based e-mail groups by eGroups.com
              • Norma Armstrong
                Thanks for the tip I put that in. Norma ... eGroup home: http://www.eGroups.com/list/ntb-clips Free Web-based e-mail groups by eGroups.com
                Message 7 of 9 , Apr 2, 1999
                  Thanks for the tip I put that in.
                  Norma
                  >
                  >
                  > wayne@... (Wayne VanWeerthuizen) wrote:
                  >
                  > >H="File listing into an Array"
                  >
                  > ...lines skipped...
                  >
                  > >^!Goto Loop
                  > >:EndLoop
                  >
                  > After this point, there really should be a ^!CloseFileFind
                  >
                  > Bad of me to have forgotten that.
                  >
                  >
                  >


                  ------------------------------------------------------------------------
                  eGroup home: http://www.eGroups.com/list/ntb-clips
                  Free Web-based e-mail groups by eGroups.com
                Your message has been successfully submitted and would be delivered to recipients shortly.