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

Saving files with variables

Expand Messages
  • Lee Underwood
    O.k., I know I have seen it somewhere, and I searched through my e-mail archive and the Web site but I can t find it. I just want to save a file with the clip
    Message 1 of 5 , Feb 3, 2006
    • 0 Attachment
      O.k., I know I have seen it somewhere, and I searched through my
      e-mail archive and the Web site but I can't find it.

      I just want to save a file with the clip inserting a variable. Here
      is what I have:

      ^!Save AS G:\data\fileDir\^$GetDate(mm-dd-yyyy)$-HERE IS WHERE I NEED
      THE VARIABLE.txt

      What I want is, if there is already a file named "02-03-2006-1", it
      would name the next file "02-03-2006-2". I just can't seem to figure
      out how to get the clip to insert the number.

      Lee

      ----------



      No virus found in this outgoing message.
      Checked by AVG Anti-Virus.
      Version: 7.1.375 / Virus Database: 267.15.0/249 - Release Date: 2/2/2006


      [Non-text portions of this message have been removed]
    • Lee Underwood
      O.K., I found the previous one I had asked for. It s here below. But I don t want to rename files, just add a different number. Can it just be edited to do
      Message 2 of 5 , Feb 3, 2006
      • 0 Attachment
        O.K., I found the previous one I had asked for. It's here below. But
        I don't want to rename files, just add a different number. Can it
        just be edited to do that? I can't really tell myself.

        Lee

        ...............................

        ; Define basic file-name, including drive and path but excluding extension
        ^!Set %File%="e:\1-TNS\1-MAIN\daily"
        ; Find highest numbered existing file
        ^!Set %n%=0
        ^!Inc %n%
        ^!IfFileExist "^%File%^%n%.htm" Skip_-1
        ; n is now 1 greater than highest numbered existing file
        ^!If ^%n%=1 RenameDaily
        ^!set %old%=^%n%
        ^!dec %old%
        ; old is now equal to highest numbered existing file
        ;
        ; there may be some desired limit that old should not exceed: 5, 7, 31, 99,
        365, or ???
        ; if so code like the following 5 lines should be included ("7" used for
        illustration.)
        ^!If ^%old^<7 Renumber
        ^!DeleteFile "^%File%^%old%.htm"
        ^!dec %old%
        ^!dec %n%
        ^!If ^%old% >=7 Skip_-3
        ;
        :Renumber
        ; Renumber files in descending order
        ^!RenameFile "^%File%^%old%.htm" "^%File%^%n%.htm"
        ^!dec %old%
        ^!dec %n%
        ^!If ^%old%>=1 Skip_-3
        :RenameDaily
        ; Now rename daily.htm to daily1.htm
        ^!RenameFile "^%File%.htm" "^%File%^%n%.htm"
        :End


        ..............................


        On 2/3/2006 11:25 AM, Lee Underwood wrote:
        ........................................................
        >O.k., I know I have seen it somewhere, and I searched through my
        >e-mail archive and the Web site but I can't find it.
        >
        >I just want to save a file with the clip inserting a variable. Here
        >is what I have:
        >
        >^!Save AS G:\data\fileDir\^$GetDate(mm-dd-yyyy)$-HERE IS WHERE I NEED
        >THE VARIABLE.txt
        >
        >What I want is, if there is already a file named "02-03-2006-1", it
        >would name the next file "02-03-2006-2". I just can't seem to figure
        >out how to get the clip to insert the number.
        >
        >Lee
        >
        > ----------
        ........................................................
        ----------



        No virus found in this outgoing message.
        Checked by AVG Anti-Virus.
        Version: 7.1.375 / Virus Database: 267.15.1/250 - Release Date: 2/3/2006


        [Non-text portions of this message have been removed]
      • hsavage
        ... extension ... Lee, Can you supply a short dirlist of real world filenames and a comparable list of what you want them to be after rtc, running the clip .
        Message 3 of 5 , Feb 5, 2006
        • 0 Attachment
          Lee Underwood wrote:
          > O.K., I found the previous one I had asked for. It's here below. But
          > I don't want to rename files, just add a different number. Can it
          > just be edited to do that? I can't really tell myself.
          >
          > Lee
          >
          > ...............................
          >
          > ; Define basic file-name, including drive and path but excluding
          extension
          > ^!Set %File%="e:\1-TNS\1-MAIN\daily"
          > ; Find highest numbered existing file
          > ^!RenameFile "^%File%.htm" "^%File%^%n%.htm"
          > :End
          >
          > ..............................
          >
          >
          > On 2/3/2006 11:25 AM, Lee Underwood wrote:
          > ........................................................
          >> What I want is, if there is already a file named "02-03-2006-1", it
          >> would name the next file "02-03-2006-2". I just can't seem to figure
          >> out how to get the clip to insert the number.
          >>
          >> Lee

          Lee,

          Can you supply a short dirlist of real world filenames and a comparable
          list of what you want them to be after rtc, 'running the clip'.

          ºvº
          06.02.05
          "Bathroom Etiquette I: Men Need Space in the Bathroom Cabinet Too."
          hrs ø hsavage@...
        • Bob McAllister
          ... Lee The smarts in the Clip you have lie in the use of IfFileExist while steadily increasing the value stored in %n%. That can be applied to your new task
          Message 4 of 5 , Feb 5, 2006
          • 0 Attachment
            On 2/4/06, Lee Underwood <leeu@...> wrote:
            > O.K., I found the previous one I had asked for. It's here below. But
            > I don't want to rename files, just add a different number. Can it
            > just be edited to do that? I can't really tell myself.
            >
            > ; Find highest numbered existing file
            > ^!Set %n%=0
            > ^!Inc %n%
            > ^!IfFileExist "^%File%^%n%.htm" Skip_-1
            > ; n is now 1 greater than highest numbered existing file

            Lee

            The "smarts" in the Clip you have lie in the use of IfFileExist while
            steadily increasing the value stored in %n%.

            That can be applied to your new task as below.

            ;SeqFileName based on date
            ^!Set %dir%=^?{(T=D)Directory=}
            ^!Set %basename%=^$GetDate(mm-dd-yyyy)$
            ^!Append %basename%=-
            ; Find highest numbered existing file
            ^!Set %n%=0
            ^!Inc %n%
            ^!IfFileExist "^%dir%^%basename%^%n%.txt" Skip_-1
            ; n is now 1 greater than highest numbered existing file
            ^!Save AS ^%dir%^%basename%^%n%.txt

            I have used a wizard in the first line to request the path to the
            directory. If you will always be using the same path, you can change
            it to
            ^!Set %dir%=G:\data\fileDir\

            Hope this helps

            Bob
          • Lee Underwood
            Bob, That s it exactly! It works great. Thanks! I can see what you mean ... variables are great! Lee On 2/6/2006 02:27 AM, Bob McAllister wrote: ...
            Message 5 of 5 , Feb 6, 2006
            • 0 Attachment
              Bob,

              That's it exactly! It works great. Thanks! I can see what you mean
              ... variables are great!

              Lee


              On 2/6/2006 02:27 AM, Bob McAllister wrote:
              ........................................................

              >Lee
              >
              >The "smarts" in the Clip you have lie in the use of IfFileExist while
              >steadily increasing the value stored in %n%.
              >
              >That can be applied to your new task as below.
              >
              >;SeqFileName based on date
              >^!Set %dir%=^?{(T=D)Directory=}
              >^!Set %basename%=^$GetDate(mm-dd-yyyy)$
              >^!Append %basename%=-
              >; Find highest numbered existing file
              >^!Set %n%=0
              >^!Inc %n%
              >^!IfFileExist "^%dir%^%basename%^%n%.txt" Skip_-1
              >; n is now 1 greater than highest numbered existing file
              >^!Save AS ^%dir%^%basename%^%n%.txt
              >
              >I have used a wizard in the first line to request the path to the
              >directory. If you will always be using the same path, you can change
              >it to
              >^!Set %dir%=G:\data\fileDir\
              >
              >Hope this helps
              >
              >Bob
              ........................................................


              --
              No virus found in this outgoing message.
              Checked by AVG Anti-Virus.
              Version: 7.1.375 / Virus Database: 267.15.2/251 - Release Date: 2/4/2006
            Your message has been successfully submitted and would be delivered to recipients shortly.