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

First line of text to file name??

Expand Messages
  • Ryck Lent
    I have been searching for a simple clip button to turn the first line of a document into the file name. This would be similar to a function in Word that
    Message 1 of 6 , Dec 2, 2010
    • 0 Attachment
      I have been searching for a simple clip button to turn the first line of a
      document into the file name. This would be similar to a function in Word that
      proposes the first line as a possible file name when saving the first time.

      Does anyone know if such a clip button function exists already?

      The button function would:

      Select some n of the characters of the fist line of the file
      Save the selected characters in a variable
      Activate the file "Save As" function
      Paste the stored variable into the file name box
      Prompt or confirm file save location
      Save the file

      Thanks for any help.
    • Don
      Quick and dirty, something like this: ^!Find ^(.{1,20}) TIWRS ^!Set %filename%=^$GetSelection$ ^!Save As ^%filename%.txt
      Message 2 of 6 , Dec 2, 2010
      • 0 Attachment
        Quick and dirty, something like this:
        ^!Find ^(.{1,20}) TIWRS
        ^!Set %filename%=^$GetSelection$
        ^!Save As "^%filename%.txt"


        On 12/2/2010 3:02 PM, Ryck Lent wrote:
        > I have been searching for a simple clip button to turn the first line of a
        > document into the file name. This would be similar to a function in Word that
        > proposes the first line as a possible file name when saving the first time.
        >
        > Does anyone know if such a clip button function exists already?
        >
        > The button function would:
        >
        > Select some n of the characters of the fist line of the file
        > Save the selected characters in a variable
        > Activate the file "Save As" function
        > Paste the stored variable into the file name box
        > Prompt or confirm file save location
        > Save the file
        >
        > Thanks for any help.
        >
        >
        >
        >
        >
        > ------------------------------------
        >
        > Fookes Software: http://www.fookes.com/
        > NoteTab website: http://www.notetab.com/
        > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >
        > ***
        > Yahoo! Groups Links
        >
        >
        >
        >
      • John Shotsky
        I have a clip to do that. Many text files have characters that are not permitted in file names, like colons, slashes, etc. It s easy enough to capture some
        Message 3 of 6 , Dec 2, 2010
        • 0 Attachment
          I have a clip to do that. Many text files have characters that are not permitted in file names, like colons, slashes,
          etc. It's easy enough to capture some characters in a line, but then you have to convert the illegal ones to permitted
          file name characters. Mine simply changes all such characters to underscores. My code is not elegant, but it works, and
          is seldom used. Improvements welcomed.
          ;=====
          ^!IfFalse ^$IsAltKeyDown$ RUN
          ^!Info [L]This clip saves a file using the first line of text as a file name. ^PIllegal file name characters are removed
          from a copy of the first line.^PThe document is saved to NoteTab's default 'new document' folder.
          ^!GoTo End
          :RUN
          ^!Jump Doc_Start
          ^!Replace "\A\R*(..+)\R" >> "$1\r\n$1\r\n" HRS
          ^!Jump Doc_Start
          ^!Select Line
          ^!Replace "^(.+)[\/\?\<\>\\\:\*\|\"](.+)\R" >> "$1_$2\r\n" HRS0
          ^!IfError Next Else Skip_-3
          ^!Jump Doc_Start
          ^!Select Line
          ^!Set %RenameDoc%=^$GetLine$
          ^!Save as ^%RenameDoc%.txt
          ^!Jump Doc_Start
          ^!Replace "^(..+)\R" >> "" HRS
          ^!Save
          :End
          ;=====

          Regards,
          John
          <http://recipetoolz.com/> http://recipetoolz.com

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ryck Lent
          Sent: Thursday, December 02, 2010 12:02 PM
          To: ntb-clips@yahoogroups.com
          Subject: [Clip] First line of text to file name??


          I have been searching for a simple clip button to turn the first line of a
          document into the file name. This would be similar to a function in Word that
          proposes the first line as a possible file name when saving the first time.

          Does anyone know if such a clip button function exists already?

          The button function would:

          Select some n of the characters of the fist line of the file
          Save the selected characters in a variable
          Activate the file "Save As" function
          Paste the stored variable into the file name box
          Prompt or confirm file save location
          Save the file

          Thanks for any help.



          [Non-text portions of this message have been removed]
        • Ryck Lent
          WOW!! I have been a user of NT Pro for more years 13? 15? than I can remember, and a member of this list for a long time as well. Now I know why! Thanks so
          Message 4 of 6 , Dec 3, 2010
          • 0 Attachment
            WOW!! I have been a user of NT Pro for more years 13? 15? than I can remember,
            and a member of this list for a long time as well. Now I know why!

            Thanks so much for the responses. I will use and tinker with the solutions
            submitted.

            Again, thanks!

            Ryck

            _________________________________________________

            2a. First line of text to file name??
            Posted by: "Ryck Lent" rycklent@... rycklent
            Date: Thu Dec 2, 2010 12:02 pm ((PST))

            I have been searching for a simple clip button to turn the first line of a
            document into the file name. This would be similar to a function in Word that
            proposes the first line as a possible file name when saving the first time.

            Does anyone know if such a clip button function exists already?

            The button function would:

            Select some n of the characters of the fist line of the file
            Save the selected characters in a variable
            Activate the file "Save As" function
            Paste the stored variable into the file name box
            Prompt or confirm file save location
            Save the file

            Thanks for any help.








            Messages in this topic (3)
            ________________________________________________________________________
            2b. Re: First line of text to file name??
            Posted by: "Don" don@... dpasseng
            Date: Thu Dec 2, 2010 12:12 pm ((PST))

            Quick and dirty, something like this:
            ^!Find ^(.{1,20}) TIWRS
            ^!Set %filename%=^$GetSelection$
            ^!Save As "^%filename%.txt"


            On 12/2/2010 3:02 PM, Ryck Lent wrote:
            > I have been searching for a simple clip button to turn the first line of a
            > document into the file name. This would be similar to a function in Word that
            > proposes the first line as a possible file name when saving the first time.
            >
            > Does anyone know if such a clip button function exists already?
            >
            > The button function would:
            >
            > Select some n of the characters of the fist line of the file
            > Save the selected characters in a variable
            > Activate the file "Save As" function
            > Paste the stored variable into the file name box
            > Prompt or confirm file save location
            > Save the file
            >
            > Thanks for any help.
            >
            >
            >
            >
            >
            > ------------------------------------
            >
            > Fookes Software: http://www.fookes.com/
            > NoteTab website: http://www.notetab.com/
            > NoteTab Discussion Lists: http://www.notetab.com/groups.php
            >
            > ***
            > Yahoo! Groups Links
            >
            >
            >
            >





            Messages in this topic (3)
            ________________________________________________________________________
            2c. Re: First line of text to file name??
            Posted by: "John Shotsky" jshotsky@... shotsky1
            Date: Thu Dec 2, 2010 12:30 pm ((PST))

            I have a clip to do that. Many text files have characters that are not permitted

            in file names, like colons, slashes,
            etc. It's easy enough to capture some characters in a line, but then you have
            to convert the illegal ones to permitted
            file name characters. Mine simply changes all such characters to underscores. My

            code is not elegant, but it works, and
            is seldom used. Improvements welcomed.
            ;=====
            ^!IfFalse ^$IsAltKeyDown$ RUN
            ^!Info [L]This clip saves a file using the first line of text as a file name.
            ^PIllegal file name characters are removed
            from a copy of the first line.^PThe document is saved to NoteTab's default 'new
            document' folder.
            ^!GoTo End
            :RUN
            ^!Jump Doc_Start
            ^!Replace "\A\R*(..+)\R" >> "$1\r\n$1\r\n" HRS
            ^!Jump Doc_Start
            ^!Select Line
            ^!Replace "^(.+)[\/\?\<\>\\\:\*\|\"](.+)\R" >> "$1_$2\r\n" HRS0
            ^!IfError Next Else Skip_-3
            ^!Jump Doc_Start
            ^!Select Line
            ^!Set %RenameDoc%=^$GetLine$
            ^!Save as ^%RenameDoc%.txt
            ^!Jump Doc_Start
            ^!Replace "^(..+)\R" >> "" HRS
            ^!Save
            :End
            ;=====

            Regards,
            John
            <http://recipetoolz.com/> http://recipetoolz.com

            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of
            Ryck Lent
            Sent: Thursday, December 02, 2010 12:02 PM
            To: ntb-clips@yahoogroups.com
            Subject: [Clip] First line of text to file name??


            I have been searching for a simple clip button to turn the first line of a
            document into the file name. This would be similar to a function in Word that
            proposes the first line as a possible file name when saving the first time.

            Does anyone know if such a clip button function exists already?

            The button function would:

            Select some n of the characters of the fist line of the file
            Save the selected characters in a variable
            Activate the file "Save As" function
            Paste the stored variable into the file name box
            Prompt or confirm file save location
            Save the file

            Thanks for any help.



            [Non-text portions of this message have been removed]






            Messages in this topic (3)



            Fookes Software: http://www.fookes.com/
            NoteTab website: http://www.notetab.com/
            NoteTab Discussion Lists: http://www.notetab.com/groups.php

            ***


            ------------------------------------------------------------------------
            Yahoo! Groups Links



            ------------------------------------------------------------------------
          • flo.gehrke
            ... John, Here s another idea. Enter the line... jo hn-sho?t:sky.txt and select it. Now start the following clip and see how NT will replace illegal characters
            Message 5 of 6 , Dec 4, 2010
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
              >
              > I have a clip to do that...Mine simply changes all such characters
              > to underscores. My code is not elegant, but it works, and
              > is seldom used. Improvements welcomed.
              >
              > ^!IfFalse ^$IsAltKeyDown$ RUN
              > ^!Info [L]This clip saves a file using the first line of text as a file name. ^PIllegal file name characters are removed
              > from a copy of the first line.^PThe document is saved to NoteTab's default 'new document' folder.
              > ^!GoTo End
              > :RUN
              > ^!Jump Doc_Start
              > ^!Replace "\A\R*(..+)\R" >> "$1\r\n$1\r\n" HRS
              > ^!Jump Doc_Start
              > ^!Select Line
              > ^!Replace "^(.+)[\/\?\<\>\\\:\*\|\"](.+)\R" >> "$1_$2\r\n" HRS0
              > ^!IfError Next Else Skip_-3
              > ^!Jump Doc_Start
              > ^!Select Line
              > ^!Set %RenameDoc%=^$GetLine$
              > ^!Save as ^%RenameDoc%.txt
              > ^!Jump Doc_Start
              > ^!Replace "^(..+)\R" >> "" HRS
              > ^!Save
              > :End


              John,

              Here's another idea. Enter the line...

              jo\hn-sho?t:sky.txt

              and select it. Now start the following clip and see how NT will replace illegal characters with underscores:


              ^!Set %Name%=^$GetSelection$
              ^!Set %Position%=1

              :Loop
              ^!Set %Proof%=^$StrCopy(^%Name%;^%Position%;1)$
              ^!IfMatch "[:\\\/\$\?]" "^%Proof%" Next Else Skip
              ^!Set %Proof%=^$StrReplace("^%Proof%";"_";^%Proof%;0;0)$
              ^!Append %CorrectName%=^%Proof%
              ^!Inc %Position%
              ^!If ^%Position% > ^$StrSize(^%Name%)$ Out
              ^!Goto Loop

              :Out
              ^!Info The correct name is ^%CorrectName%
              ^!ClearVariable %CorrectName%

              Maybe you'll have to add somemore illegal characters. This could easily be combined with the rest of the clip that saves the file...

              Regards,
              Flo
            • John Shotsky
              Thanks Flo! Yes, I can adapt that to my users needs. Regards, John http://recipetoolz.com From: ntb-clips@yahoogroups.com
              Message 6 of 6 , Dec 4, 2010
              • 0 Attachment
                Thanks Flo!
                Yes, I can adapt that to my users' needs.

                Regards,
                John
                <http://recipetoolz.com/> http://recipetoolz.com

                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of flo.gehrke
                Sent: Saturday, December 04, 2010 8:24 AM
                To: ntb-clips@yahoogroups.com
                Subject: Re: [Clip] First line of text to file name??


                --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
                >
                > I have a clip to do that...Mine simply changes all such characters
                > to underscores. My code is not elegant, but it works, and
                > is seldom used. Improvements welcomed.
                >
                > ^!IfFalse ^$IsAltKeyDown$ RUN
                > ^!Info [L]This clip saves a file using the first line of text as a file name. ^PIllegal file name characters are
                removed
                > from a copy of the first line.^PThe document is saved to NoteTab's default 'new document' folder.
                > ^!GoTo End
                > :RUN
                > ^!Jump Doc_Start
                > ^!Replace "\A\R*(..+)\R" >> "$1\r\n$1\r\n" HRS
                > ^!Jump Doc_Start
                > ^!Select Line
                > ^!Replace "^(.+)[\/\?\<\>\\\:\*\|\ <file:///\\\:\*\|\%22%5d(.+)\R> "](.+)\R" >> "$1_$2\r\n" HRS0
                > ^!IfError Next Else Skip_-3
                > ^!Jump Doc_Start
                > ^!Select Line
                > ^!Set %RenameDoc%=^$GetLine$
                > ^!Save as ^%RenameDoc%.txt
                > ^!Jump Doc_Start
                > ^!Replace "^(..+)\R" >> "" HRS
                > ^!Save
                > :End

                John,

                Here's another idea. Enter the line...

                jo\hn-sho?t:sky.txt

                and select it. Now start the following clip and see how NT will replace illegal characters with underscores:

                ^!Set %Name%=^$GetSelection$
                ^!Set %Position%=1

                :Loop
                ^!Set %Proof%=^$StrCopy(^%Name%;^%Position%;1)$
                ^!IfMatch "[:\\\/\$\?]" "^%Proof%" Next Else Skip
                ^!Set %Proof%=^$StrReplace("^%Proof%";"_";^%Proof%;0;0)$
                ^!Append %CorrectName%=^%Proof%
                ^!Inc %Position%
                ^!If ^%Position% > ^$StrSize(^%Name%)$ Out
                ^!Goto Loop

                :Out
                ^!Info The correct name is ^%CorrectName%
                ^!ClearVariable %CorrectName%

                Maybe you'll have to add somemore illegal characters. This could easily be combined with the rest of the clip that saves
                the file...

                Regards,
                Flo



                [Non-text portions of this message have been removed]
              Your message has been successfully submitted and would be delivered to recipients shortly.