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

running a clip on all files in a directory

Expand Messages
  • Steve LaMantia
    Hi. Is there a way to run a clip on all files in a directory? I think I can see a way to do it via ^!Open *.* and ^!Document First|Next, but I was just
    Message 1 of 7 , Jan 1, 2005
    • 0 Attachment
      Hi.

      Is there a way to run a clip on all files
      in a directory? I think I can see a way
      to do it via ^!Open *.* and ^!Document
      First|Next, but I was just wondering
      if there was a native NoteTab way to
      just do it via command line, something
      like, say,

      Notetab.exe MyClip.clb C:\temp\*.txt

      Any ideas? Thanks.

      By the way, in code, what's the way to
      tell when Document Next has reached
      the last file? I can see doing it via
      variables and storing each filename before
      going Next and then comparing it to see
      if it's the same, but is there a better
      way?

      Thanks again. (Oh, it's version 4.9np.)

      -- Steve
    • Jody
      Hi Steve, Happy New Year everyone! ... Only by calling a Library and Clip. Wildcards cannot be used to open files. You can open multiple files, but you have to
      Message 2 of 7 , Jan 1, 2005
      • 0 Attachment
        Hi Steve,

        Happy New Year everyone!

        >Is there a way to run a clip on all files in a directory? I
        >think I can see a way to do it via ^!Open *.* and ^!Document
        >First|Next, but I was just wondering if there was a native
        >NoteTab way to just do it via command line, something like, say,
        >
        >Notetab.exe MyClip.clb C:\temp\*.txt

        Only by calling a Library and Clip. Wildcards cannot be used to
        open files. You can open multiple files, but you have to list
        each file individually delimited in quotes.

        /L=LibraryName:RunClip

        I stripped a lot of code from this taken from my DirStuff. I
        renamed the original to Open Directory... With Stats and called
        this the same (which is now in DirStuff) except for it is
        followed with Basic. The ^!Set %Folder% is one long line till the
        blank line. You can just download my DirStuff if you which.
        (There's a checkbox open for a directory also if you prefer that.
        The command-line for this would be...

        NotePro /L="DirStuff:Open Directory... Basic"

        <--- Copy below this line --->
        H=Open Directory... Basic
        ; eMailed on 01-01-2005, ntb-clips@yahoogroups.com, Jody
        ; notetab.net, clean-funnies.com, fookes.us, sojourner.us
        ; Requires NoteTab v4.83

        ^!Continue Opens all files in a folder by file type(s), with option to open subdirectories. Continue?

        ^!Set %Folder%=^?{(T=D)&Browse: full path, end in backslash}; %Subs%=^?{Do su&bfolders=Yes^=+|_No^=}; %Type%=^?{(H=10)File &Types, wildcards OK: *.txt or *.*htm*;*.txt=*.*|*.htm;*.htm*;*.*htm*|_*.txt|*.*htm*;*.txt|*.otl|*.clb|*.ini}

        ^!SetHintInfo Opening Files...
        ^!SetScreenUpdate Off

        ^!SetListDelimiter ^p
        ^!SetArray %OpenList%=^$GetFiles("^%Subs%^%Folder%";^%Type%)$
        ^!Set %Count%=^%OpenList0%
        ^!Set %Index%=0

        :Loop
        ^!Inc %Index%
        ^!If ^%Index% > ^%Count% End
        ^!Open ^%OpenList^%Index%%
        ^!Goto Loop

        <--- Copy above this line --->
        <--- Right click over a Library --->
        <--- Choose: Add from Clipboard --->

        NoteTabbers Assistant Page
        http://www.notetab.net/
        Directory Stuff aka DirStuff
        http://www.notetab.net/zip/dirstuff.zip
        Sojourner's Five Wink Software
        Check out: http://www.sojourner.us/software sometime. :)

        >By the way, in code, what's the way to tell when Document Next
        >has reached the last file? I can see doing it via variables and
        >storing each filename before going Next and then comparing it to
        >see if it's the same, but is there a better way?

        ^!If ^$GetDocCount$ = ^$GetDocIndex$

        Happy Clip'n!
        Jody

        www.clean-funnies.com, http://www.fookes.us/maillist.htm

        Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
        UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
        Options: http://groups.yahoo.com/group/ntb-clips
      • Steve LaMantia
        Thanks, Jody. I ll give that clip a whirl after work tonight. ... Excellent! Thanks! -- Steve
        Message 3 of 7 , Jan 1, 2005
        • 0 Attachment
          Thanks, Jody. I'll give that clip a whirl after work tonight.

          > > By the way, in code, what's the way to tell when Document Next
          > > has reached the last file? I can see doing it via variables and
          > > storing each filename before going Next and then comparing it to
          > > see if it's the same, but is there a better way?

          > ^!If ^$GetDocCount$ = ^$GetDocIndex$

          Excellent! Thanks!

          -- Steve
        • Jody
          Hi Steve, ... Reading between the lines it appears you want to do something with each file that opens. Using the code above, you do not need to know when you
          Message 4 of 7 , Jan 1, 2005
          • 0 Attachment
            Hi Steve,

            >H=Open Directory... Basic
            >
            >^!SetListDelimiter ^p
            >^!SetArray %OpenList%=^$GetFiles("^%Subs%^%Folder%";^%Type%)$
            >^!Set %Count%=^%OpenList0%
            >^!Set %Index%=0
            >
            >:Loop
            >^!Inc %Index%
            >^!If ^%Index% > ^%Count% End
            >^!Open ^%OpenList^%Index%%
            >^!Goto Loop

            Reading between the lines it appears you want to do something
            with each file that opens. Using the code above, you do not need
            to know when you are at the last document. In other words, you do
            not use ^!Document Next/Last. Instead, right after the ^!Open
            command you do what you need to edit the file, then ^!Close Save.
            For instance:

            ^!Open ^%OpenList^%Index%%
            ^!Find "</head>" S
            ^!InsertText ^p<a name="top"></a>^p
            ^!Close Save
            ^!Goto Loop

            That one will be done to every document opened and when the index
            greater than the count (which will be the last document, the Clip
            will end.

            ^!If ^%Index% > ^%Count% End

            >^!If ^$GetDocCount$ = ^$GetDocIndex$

            That would be used with opened documents and you want to scan
            through them doing some editing using like...

            ^!Document First
            :Loop
            ; edit stuff
            ^!If ^$GetDocCount$ = ^$GetDocIndex$ End
            ^!Document Next
            ^!Goto Loop

            Happy Clip'n!
            Jody

            www.clean-funnies.com, http://www.fookes.us/maillist.htm

            Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
            UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
            Options: http://groups.yahoo.com/group/ntb-clips
          • Jeff Scism
            This will also be great to use with Farclip. (Could probably have a check box wizard to pick which clip to run from afar.)
            Message 5 of 7 , Jan 1, 2005
            • 0 Attachment
              This will also be great to use with Farclip.

              (Could probably have a check box wizard to pick which clip to run from
              afar.)
            • Jody
              Hi Jeff, ... Yes. ... I don t think I would pick a Clip to run from afar, but call the fire department. ;) (You might need to understand
              Message 6 of 7 , Jan 3, 2005
              • 0 Attachment
                Hi Jeff,

                >This will also be great to use with Farclip.

                Yes.

                >(Could probably have a check box wizard to pick which clip to run
                >from afar.)

                I don't think I would pick a "Clip to run from afar," but
                call the fire department. <groan> ;) (You might need to understand
                hillbillie/Southern to get it.)

                You would not use a checkbox wizard for that unless you would be
                running more than one Clip and then you would need to put it in
                an array. That you be a difficult thing to do when you would
                normally just run the parent Clip and call a ^!Clip from it. You
                would use the wizard below to pick a Clip to run though forcing a
                choice, but only one choice.

                ^!FarClip ^?{(H=20)Run what Clip==HTML:Color|Back:"Tabs to Spaces"|Back:GetLine|Utilities:"Underline Title"}

                See ya in the funnies!
                Jody

                ...he that is of a merry heart hath a continual feast...
                http://www.clean-funnies.com

                If you haven't laughed at yourself today,
                you missed a good joke! 8?D

                The NoteTabbers Assistant Page
                http://www.notetab.net


                [Non-text portions of this message have been removed]
              • Dave
                Hi Jody I never would have thought of doing that ,A bit bright!! it also works. THANKYOU DAVE in au ... From: Jody To:
                Message 7 of 7 , Jan 5, 2005
                • 0 Attachment
                  Hi Jody
                  I never would have thought of doing that ,A bit bright!! it also works.

                  THANKYOU DAVE in au



                  ----- Original Message -----
                  From: "Jody" <kjv-av1611@...>
                  To: <ntb-clips@yahoogroups.com>
                  Sent: Tuesday, January 04, 2005 11:13 AM
                  Subject: Re: [Clip] running a clip on all files in a directory


                  >
                  > Hi Jeff,
                  >
                  >>This will also be great to use with Farclip.
                  >
                  > Yes.
                  >
                  >>(Could probably have a check box wizard to pick which clip to run
                  >>from afar.)
                  >
                  > I don't think I would pick a "Clip to run from afar," but
                  > call the fire department. <groan> ;) (You might need to understand
                  > hillbillie/Southern to get it.)
                  >
                  > You would not use a checkbox wizard for that unless you would be
                  > running more than one Clip and then you would need to put it in
                  > an array. That you be a difficult thing to do when you would
                  > normally just run the parent Clip and call a ^!Clip from it. You
                  > would use the wizard below to pick a Clip to run though forcing a
                  > choice, but only one choice.
                  >
                  > ^!FarClip ^?{(H=20)Run what Clip==HTML:Color|Back:"Tabs to
                  > Spaces"|Back:GetLine|Utilities:"Underline Title"}
                  >
                  > See ya in the funnies!
                  > Jody
                  >
                  > ...he that is of a merry heart hath a continual feast...
                  > http://www.clean-funnies.com
                  >
                  > If you haven't laughed at yourself today,
                  > you missed a good joke! 8?D
                  >
                  > The NoteTabbers Assistant Page
                  > http://www.notetab.net
                  >
                  >
                  > [Non-text portions of this message have been removed]
                  >
                  >
                  >
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.