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

Run a simple clip on a folder of files? How is best way?

Expand Messages
  • Doug Offen
    I know that G will run a clip action on all open files. I want to run a clip involving several actiona that need to be done in sequence. I suspect the G will
    Message 1 of 6 , May 31 10:27 AM
      I know that "G" will run a clip action on all open files.

      I want to run a clip involving several actiona that need to be done in
      sequence. I suspect the G will not work. I have never been able to
      set up a loop that works, but I suspect that is the way to go.

      Here is the clip that works perfectly on one file. Any suggestions? I
      know it's not pretty, but it works for me. The notes are so I can
      remember what I was trying to do with each clip sequence.

      --------------------------------
      ;^!continue Takes our hard returns and substitutes double hard returns
      at end of ;paragraphs.
      ;^!SetDebug ON
      ;selects first line and makes sure it is capitalized
      ^!Keyboard Ctrl+Home
      ^!Keyboard Shift+End
      ^!Keyboard Shift+Ctrl+k
      ;goes to home then down 1 line adds return then selects to end
      ^!Keyboard Ctrl+Home
      ^!Keyboard down
      ^!Keyboard Enter
      ^!Keyboard Ctrl+Shift+end
      ;^!continue Takes our hard returns and substitutes double hard returns
      at end of ;paragraphs for selected text.
      ;^!SetDebug ON
      ;^!Check that text selected
      ;repaces double space with single space
      ^!Replace " " >> " " HAS
      ^!Replace " " >> " " HAS
      ^!Replace " " >> " " HAS
      ^!Replace " " >> " " HAS
      ^!Replace " " >> " " HAS
      ^!Replace " " >> " " HAS
      ^!Replace " " >> " " HAS
      ^!Replace "-^T" >> " " HAS
      ^!Replace "^T" >> " " HAS
      ;replaces space hard return with hard return
      ^!Replace " ^P" >> "^P" HAS
      ;replaces punctuation and return with marker and return
      ^!Replace "-^P" >> "NPP-^P" HAS
      ^!Replace ""^P" >> "NPP"^P" HAS
      ^!Replace ".^P" >> "NPP.^P" HAS
      ^!Replace "!^P" >> "NPP!^P" HAS
      ^!Replace "?^P" >> "NPP?^P" HAS
      ;replaces double hard returns with single
      ^!Replace "^P^P" >> "^P" HAS
      ;replaces single hard returns with space
      ^!Replace "^P" >> " " HAS
      ;replaces NPP markers with punctuation and double hard returns
      ^!Replace "NPP" " >> ""^P^P" HAS
      ^!Replace "NPP. " >> ".^P^P" HAS
      ^!Replace "NPP! " >> "!^P^P" HAS
      ^!Replace "NPP? " >> "?^P^P" HAS
      ^!Replace "NWP?" >> "?^P^P" HAS
      ^!Replace "NPP-" >> "-^P^P" HAS
      ^!Replace "^T" >> " " HAS
      ;removes any indentation
      ^!Menu Edit/Select All
      ^!Menu Modify/Lines/unindent
      ^!Menu Modify/Lines/unindent
      ^!Menu Modify/Lines/unindent
      ;^!Keyboard "Shift+Ctrl+I"

      ;^!Replace "" >> "" HAS copy of replace code
      ;...save document to original name
      ^!Keyboard "Ctrl+s"
      ;Activate this line instead of above line if you want it to be saved
      as another file name.
      ;^!Keyboard "Shift_Ctrl+s"

      ------------------------------

      Thanks for any help and suggestions.

      Doug Offen
    • Jody
      Hi Doug, ... There s a number of ways to do what you want, but I did this one that I think is the easiest for you to understand. It s overkill as far as the
      Message 2 of 6 , May 31 11:40 AM
        Hi Doug,

        >I know that "G" will run a clip action on all open files.
        >
        >I want to run a clip involving several actiona that need to be done in
        >sequence. I suspect the G will not work. I have never been able to
        >set up a loop that works, but I suspect that is the way to go.
        >
        >Here is the clip that works perfectly on one file. Any suggestions? I
        >know it's not pretty, but it works for me. The notes are so I can
        >remember what I was trying to do with each clip sequence.
        >
        >--------------------------------
        >;^!continue Takes our hard returns and substitutes double hard returns
        >at end of ;paragraphs.

        There's a number of ways to do what you want, but I did this one
        that I think is the easiest for you to understand. It's overkill
        as far as the amount of code goes, and you can call the code from
        a different Clip to make your clip look nicer, but for now, you
        add your code below where it says to. There are a number of
        examples in my DirStuff to study as well. (See below.)

        H=Easy code to take action on all open files, save and close them...
        ^!Document Last
        ; do your editing here
        ^!Close Save

        :NextFile
        ; If you get a 1 returned for ^$GetDocIndex$, then that means you
        ; are at the first file, so...

        ^!If ^$GetDocIndex$ = 1 FirstFile
        ^!Save Close
        ^!Goto NextFile

        :FirstFile
        ; do your editing here on the last file to do which is tab index number 1.
        ^!Save Close

        ; Note: If you don't do the ^!Save Close and want to use say just ^!Save
        ; You'll need to use ^!Document Prev in place of ^!Save Close.

        ; ---------------------

        I have a number of Clips that work with directories in my
        DirStuff. You'll find some that you can modify to do what you
        want.

        NoteTabbers Assistant Library Page
        http://www.notetab.net/
        http://www.notetab.net/html/library.htm
        Direct download for DirStuff
        http://www.notetab.net/zip/dirstuff.zip


        Happy Clip'n!
        Jody

        All Lists: http://www.fookes.us/maillist.htm
        Convert your eMail programs... Aid4Mail: http://www.fookes.us/aid4mail

        Freeware and Shareware; some seamleesly integrates with NoteTab:
        http://www.sojourner.us/software

        See ya in the funnies!-) http://www.clean-funnies.com
      • Phillip Sand Hansel II
        This example gets a list of folders and runs the clip on each folder s contents. My issue was many folders that have specific files that need to be archived. I
        Message 3 of 6 , May 31 2:36 PM
          This example gets a list of folders and runs the clip on each folder's
          contents. My issue was many folders that have specific files that need to be
          archived. I thought my first version was great because I could archive a
          project with just 12 mouse clicks, then after reading someone's post about
          working with directories, I was able to convert my clip to run on a bunch of
          folders using just one click per project. Massive time (and wrist) saver.
          I operate on the files, but don't actually open any in notetab. I am
          including the whole example, though you probably just need the folder and
          loop parts.

          Watch the email line wraps, if notetab does not highlight things correctly,
          a line may need to be re-joined.

          --------- 8< --------------------
          ; PowerLog Project Parameter Batch Archive Procedure (PPPBAP)
          ; Prompts for a client folder name, then zips up all Powerlog Project
          Parameter files from that folder and moves the zip to an archive folder to
          be burned to CD at a later time. Then, it goes on to the next folder for the
          specified client and archives it, etc...
          ; 4/21/06 Updated to batch process a series of projects in a particular
          client's folder.
          ;
          ; Mr. Phillip Sand Hansel II 7/25/05 with thanks to Jody Adair, Don
          Passenger, hsavage, et al...

          ; For debugging, uncomment next line.
          ;^!SetDebug On

          ; finds path to winzip. open & save folders in Notetab Users .ini file (Must
          have run Setup WinZip first!)
          ^!SetIniFile NtbUsers
          ^!SetScreenUpdate 0
          ; Prompt for Client folder that contains folders of projects to be archived,
          ; and a storage location for the final output. Provide changeable defaults
          via NtbUsers.INI file.
          ^!Set %OpenZip%="^?{(T=D)Path to client folder
          =C:\PROJECT\a2dtech\working\}"; %SaveZip%="^?{(T=D)Path to archive storage
          location =^$GetValue("WinZip:SaveZip")$}"

          ; Make a list of sub-folders in a client's folder.
          ^!SetListDelimiter ^p
          ^!SetArray %ProjFolders%=^$GetDosOutput("dir/ad/b/l/on ^%OpenZip%*")$
          ;Copy the value representing the number of items into the Count variable.
          ;The variable at index 0 indicates the number of items in the array.
          ^!Set %Count%=^%ProjFolders0%
          ;Initialize the Index variable to 0
          ^!Set %Index%=0

          ;Beginning of loop
          :StartLoop
          ;Add one to the value contained in the variable Index
          ^!Inc %Index%
          ;End the Clip if the Index number is equal to the Count number
          ^!If ^%Index% = ^%Count% DONE
          ;Show the file name corresponding to the current index value.
          ; The content of the array's indexed variable is used here. Note the
          placement of %% delimitor.
          ^!Set %Path%=^%OpenZip%^%ProjFolders^%Index%%

          ; For normal wsr projects, there should be a file ending with "_w.zip"
          ^!Set
          %WSRFile%=^%OpenZip%^%ProjFolders^%Index%%\^%ProjFolders^%Index%%_w.zip

          ;Since the above filename is "generated", test to see if it actually exists,
          ; if it does not exist; go to next well.
          ; This prevents backing up projects that do not have WSR files created (a
          file ending with *_w.zip).
          ^!IfFileExist ^%WSRFile% Next else StartLoop

          ; Destination file; where to archive gets written to. Generalized 5/30/6
          PSHII
          ^!SET %SaveZip2%="^%SaveZip%^%ProjFolders^%Index%%.zip"
          ;^!INFO SaveZip2= ^%SaveZip2%

          ;Files to be backed up, by filetype
          ^!Set %Files2Zip%="""^%Path%\*.TXT" "^%Path%\*.HDR" "^%Path%\*.SFT"
          "^%Path%\*.TND" "^%Path%\*.JRN" "^%Path%\*.DAT" "^%Path%\*.PSM"
          "^%Path%\*.SPL" "^%Path%\*.MDB" "^%Path%\*.BSF" "^%Path%\*_W.zip"
          "^%Path%\*WP.zip" "^%Path%\*CP.zip""

          ; run winzip, minimized, add a series of filetypes, output to a new
          location.
          ^!^$GetValue("WinZip:WinZip")$ -min -a -en "^%SaveZip2%" "^%Files2Zip%"

          ; Couldn't figure out what jody did below, but mine seems to work for me
          ;^!^$GetValue("WinZip:WinZip")$ -min -a -en ^%FileName%
          ^$StrReplace("^%sc%";"^%Space%";""^%Files%"";False;False)$

          ; Wait until WinZip is closed before continuing to next folder
          ^!Wait

          ;Jump back to the start of the loop
          ^!Goto StartLoop

          :DONE
          ;^!SaveValue WinZip:WinZip=^%WinZip%
          ^!SaveValue WinZip:SaveZip=^%SaveZip%
          ;^!SaveValue WinZip:Files2Zip=^%Files2Zip%
          ^!SaveValue WinZip:OpenZip=^%OpenZip%
          ;^!SaveValue WinZip:ExtractZip=^%ExtractZip%
          ^!INFO Processing complete

          -------------------- 8< ---------------------------

          Mr. Phillip Sand Hansel II
          http://philliphansel.com


          ----- Original Message -----
          From: "Doug Offen" <yahoo@...>
          To: <ntb-clips@yahoogroups.com>
          Sent: Wednesday, May 31, 2006 12:27 PM
          Subject: [Clip] Run a simple clip on a folder of files? How is best way?


          >I know that "G" will run a clip action on all open files.
          >
          > I want to run a clip involving several actiona that need to be done in
          > sequence. I suspect the G will not work. I have never been able to
          > set up a loop that works, but I suspect that is the way to go.
          >
          > Here is the clip that works perfectly on one file. Any suggestions? I
          > know it's not pretty, but it works for me. The notes are so I can
          > remember what I was trying to do with each clip sequence.
          >
          > --------------------------------
          > ;^!continue Takes our hard returns and substitutes double hard returns
          > at end of ;paragraphs.
          > ;^!SetDebug ON
          > ;selects first line and makes sure it is capitalized
          > ^!Keyboard Ctrl+Home
          > ^!Keyboard Shift+End
          > ^!Keyboard Shift+Ctrl+k
          > ;goes to home then down 1 line adds return then selects to end
          > ^!Keyboard Ctrl+Home
          > ^!Keyboard down
          > ^!Keyboard Enter
          > ^!Keyboard Ctrl+Shift+end
          > ;^!continue Takes our hard returns and substitutes double hard returns
          > at end of ;paragraphs for selected text.
          > ;^!SetDebug ON
          > ;^!Check that text selected
          > ;repaces double space with single space
          > ^!Replace " " >> " " HAS
          > ^!Replace " " >> " " HAS
          > ^!Replace " " >> " " HAS
          > ^!Replace " " >> " " HAS
          > ^!Replace " " >> " " HAS
          > ^!Replace " " >> " " HAS
          > ^!Replace " " >> " " HAS
          > ^!Replace "-^T" >> " " HAS
          > ^!Replace "^T" >> " " HAS
          > ;replaces space hard return with hard return
          > ^!Replace " ^P" >> "^P" HAS
          > ;replaces punctuation and return with marker and return
          > ^!Replace "-^P" >> "NPP-^P" HAS
          > ^!Replace ""^P" >> "NPP"^P" HAS
          > ^!Replace ".^P" >> "NPP.^P" HAS
          > ^!Replace "!^P" >> "NPP!^P" HAS
          > ^!Replace "?^P" >> "NPP?^P" HAS
          > ;replaces double hard returns with single
          > ^!Replace "^P^P" >> "^P" HAS
          > ;replaces single hard returns with space
          > ^!Replace "^P" >> " " HAS
          > ;replaces NPP markers with punctuation and double hard returns
          > ^!Replace "NPP" " >> ""^P^P" HAS
          > ^!Replace "NPP. " >> ".^P^P" HAS
          > ^!Replace "NPP! " >> "!^P^P" HAS
          > ^!Replace "NPP? " >> "?^P^P" HAS
          > ^!Replace "NWP?" >> "?^P^P" HAS
          > ^!Replace "NPP-" >> "-^P^P" HAS
          > ^!Replace "^T" >> " " HAS
          > ;removes any indentation
          > ^!Menu Edit/Select All
          > ^!Menu Modify/Lines/unindent
          > ^!Menu Modify/Lines/unindent
          > ^!Menu Modify/Lines/unindent
          > ;^!Keyboard "Shift+Ctrl+I"
          >
          > ;^!Replace "" >> "" HAS copy of replace code
          > ;...save document to original name
          > ^!Keyboard "Ctrl+s"
          > ;Activate this line instead of above line if you want it to be saved
          > as another file name.
          > ;^!Keyboard "Shift_Ctrl+s"
          >
          > ------------------------------
          >
          > Thanks for any help and suggestions.
          >
          > Doug Offen
          >
          >
          >
          >
          >
          >
          > Fookes Software: http://www.fookes.us, http://www.fookes.com
          > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        • Jody
          Hi Phillip, Doug, ???, ;) ... This all appears to be from my DirStuff or FtpZip. It comes from the Setup section of those Libraries to setup the default paths
          Message 4 of 6 , May 31 3:17 PM
            Hi Phillip, Doug, ???, ;)

            >; run winzip, minimized, add a series of filetypes, output to a new
            >location.
            >^!^$GetValue("WinZip:WinZip")$ -min -a -en "^%SaveZip2%" "^%Files2Zip%"
            >
            >; Couldn't figure out what jody did below, but mine seems to work for me
            >;^!^$GetValue("WinZip:WinZip")$ -min -a -en ^%FileName%
            >^$StrReplace("^%sc%";"^%Space%";""^%Files%"";False;False)$

            This all appears to be from my DirStuff or FtpZip. It comes from
            the Setup section of those Libraries to setup the default paths
            for zipping and unzipping files, and default paths of files to
            zip and where to put the files extracted. It also sets up the
            location of WinZip. It appears you only used what you needed of
            it and ;commented the rest out. (I would just remove it so it
            doesn't confuse you, the parts that you have commented out that
            is. <g> See below for the Setup WinZip.

            >; Wait until WinZip is closed before continuing to next folder
            >^!Wait
            >
            >;Jump back to the start of the loop
            >^!Goto StartLoop
            >
            >:DONE
            >;^!SaveValue WinZip:WinZip=^%WinZip%
            >^!SaveValue WinZip:SaveZip=^%SaveZip%
            >;^!SaveValue WinZip:Files2Zip=^%Files2Zip%
            >^!SaveValue WinZip:OpenZip=^%OpenZip%
            >;^!SaveValue WinZip:ExtractZip=^%ExtractZip%
            >^!INFO Processing complete

            This is the Setup section I talked about. You use the ^$GetValue function
            to get the stored paths as you did higher up in the Clip..

            H=Setup WinZip...
            ^!SetIniFile NtbUsers

            ^!Set %WinZip%=^?{(T=O)Full path of WinZip=^$GetValue("WinZip:WinZip")$}; %SaveZip%=^?{(T=D)Enter default path to save zip files=^$GetValue("WinZip:SaveZip")$}; %Files2Zip%=^?{(T=D)Enter default path of files to zip=^$GetValue("WinZip:Files2Zip")$}; %OpenZip%=^?{(T=D)Enter default path to open zip files=^$GetValue("WinZip:OpenZip")$}; %ExtractZip%=^?{(T=D)Enter default path to extract zip files=^$GetValue("WinZip:ExtractZip")$}; %Openini%=^?{Do you want to open the new or updated .ini file?==Yes^=1|_No^=}

            ^!SaveValue WinZip:WinZip=^%WinZip%
            ^!SaveValue WinZip:SaveZip=^%SaveZip%
            ^!SaveValue WinZip:Files2Zip=^%Files2Zip%
            ^!SaveValue WinZip:OpenZip=^%OpenZip%
            ^!SaveValue WinZip:ExtractZip=^%ExtractZip%
            ;^!SaveValue WinZip:SetupZip=1

            ^!IfTrue ^%Openini% Next Else End
            ^!Delay 3
            ^!Open ^$GetLibraryPath$NtbUsers.ini
            ^!Jump Doc_End
            ^!Find "[WinZip-ja]" SB



            Happy Clip'n!
            Jody

            All Lists: http://www.fookes.us/maillist.htm
            Convert your eMail programs... Aid4Mail: http://www.fookes.us/aid4mail

            Freeware and Shareware; some seamleesly integrates with NoteTab:
            http://www.sojourner.us/software

            See ya in the funnies!-) http://www.clean-funnies.com
          • Doug Offen
            Hello Jody and everyone. I have messed around with the DirStuf and searched through the help and looked at clips that have some common commands and come up
            Message 5 of 6 , Jun 1, 2006
              Hello Jody and everyone.

              I have messed around with the DirStuf and searched through the help
              and looked at clips that have some common commands and come up with a
              couple of useful to me clips that work.

              This one works through each opened text file to set up title
              capiatalization, paragraph breaks and tightens the spacing then saves
              each file again.

              ;Activates the first document in the tab bar
              ^!Document First

              ;Beginning of loop
              :Start
              ;Ask if user wants to continue Clip
              ;^!Continue Next document is now current. Continue?
              ;^!SetDebug ON
              ;selects first line and makes sure it is capitalized
              ^!Keyboard Ctrl+Home
              ^!Keyboard Shift+End
              ^!Keyboard Shift+Ctrl+k
              ;goes to home then down 1 line adds return then selects to end
              ^!Keyboard Ctrl+Home
              ^!Keyboard down
              ^!Keyboard Enter
              ^!Keyboard Ctrl+Shift+end
              ;^!continue Takes our hard returns and substitutes double hard returns
              at end of ;paragraphs for selected text.
              ;^!SetDebug ON
              ;^!Check that text selected
              ;repaces double space with single space
              ^!Replace " " >> " " HAS
              ^!Replace " " >> " " HAS
              ^!Replace " " >> " " HAS
              ^!Replace " " >> " " HAS
              ^!Replace " " >> " " HAS
              ^!Replace " " >> " " HAS
              ^!Replace " " >> " " HAS
              ^!Replace "-^T" >> " " HAS
              ^!Replace "^T" >> " " HAS
              ;replaces space hard return with hard return
              ^!Replace " ^P" >> "^P" HAS
              ;replaces punctuation and return with marker and return
              ^!Replace "-^P" >> "NPP-^P" HAS
              ^!Replace ""^P" >> "NPP"^P" HAS
              ^!Replace ".^P" >> "NPP.^P" HAS
              ^!Replace "!^P" >> "NPP!^P" HAS
              ^!Replace "?^P" >> "NPP?^P" HAS
              ;replaces double hard returns with single
              ^!Replace "^P^P" >> "^P" HAS
              ;replaces single hard returns with space
              ^!Replace "^P" >> " " HAS
              ;replaces NPP markers with punctuation and double hard returns
              ^!Replace "NPP" " >> ""^P^P" HAS
              ^!Replace "NPP. " >> ".^P^P" HAS
              ^!Replace "NPP! " >> "!^P^P" HAS
              ^!Replace "NPP? " >> "?^P^P" HAS
              ^!Replace "NWP?" >> "?^P^P" HAS
              ^!Replace "NPP-" >> "-^P^P" HAS
              ^!Replace "^T" >> " " HAS
              ;removes any indentation
              ^!Menu Edit/Select All
              ^!Menu Modify/Lines/unindent
              ^!Menu Modify/Lines/unindent
              ^!Menu Modify/Lines/unindent
              ;^!Keyboard "Shift+Ctrl+I"

              ;^!Replace "" >> "" HAS copy of replace code
              ;...save document to original name
              ^!Keyboard "Ctrl+s"
              ;Activate this line instead of above line if you want it to be saved
              as another file name.
              ;^!Keyboard "Shift_Ctrl+s"
              ^!Jump Doc_Start
              ;Activates the next document in the tab bar
              ^!Document Next
              ;End Clip if an error condition was generated (i.e. no more documents
              after the current one)
              ^!IfError End
              ;Jump back to the start of the loop
              ^!GoTo Start

              -----------------

              Thanks for your help. I still don't know why or how most of the
              file/folder commands work but messing with already working codes gets
              some results.

              Doug Offen
            • Don - HtmlFixIt.com
              this might be a better start: ;Activates the first document in the tab bar ^!Document First ;^!SetDebug On ;Beginning of loop ... ;selects first line and makes
              Message 6 of 6 , Jun 2, 2006
                this might be a better start:
                ;Activates the first document in the tab bar
                ^!Document First
                ;^!SetDebug On

                ;Beginning of loop
                :Start
                ;selects first line and makes sure it is capitalized
                ^!Jump Doc_Start
                ^!Select Eol
                ^!Keyboard Shift+Ctrl+k
                ;goes to home then down 1 line adds return then selects to end
                ^!Jump Select_End
                ^!Keyboard Enter
                ^!Keyboard Ctrl+Shift+end

                I think you should avoid keyboard commands when there is an equivalent.
                Sometimes there is not of course.
              Your message has been successfully submitted and would be delivered to recipients shortly.