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

Re: [Clip] Create File From A File

Expand Messages
  • Don - HtmlFixIt.com
    errr this: (?s)^(% R.*? ( )(.*?)( ) RM30) R Sorry stopped one short of full thought there.
    Message 1 of 21 , Dec 5, 2009
    • 0 Attachment
      errr this:
      (?s)^(% \R.*?\( )(.*?)( \)\RM30)\R

      Sorry stopped one short of full thought there.

      Don - HtmlFixIt.com wrote:
      > Try this data pattern along with getresubstrings and I think you have it:
      > (?s)^(% \R.*?\( )(SF 49A)( \)\RM30)\R
      >
      > Don - HtmlFixIt.com wrote:
      >> Of course .... if we understand what we are doing and the data pattern.
      >>
      >> Is there always a return followed by a % to start each file?
      >> Is the "filename" always the second from last line, followed by a bunch
      >> of blank lines?
      >>
      >> Is there always an M30 on the last line of each file?
      >
    • bozlawless
      Yes there is a M30 at the end of each file but no to the other stuff
      Message 2 of 21 , Dec 5, 2009
      • 0 Attachment
        Yes there is a M30 at the end of each file but no to the other stuff


        --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
        >
        > Of course .... if we understand what we are doing and the data pattern.
        >
        > Is there always a return followed by a % to start each file?
        > Is the "filename" always the second from last line, followed by a bunch
        > of blank lines?
        >
        > Is there always an M30 on the last line of each file?
        >
      • bozlawless
        Sorry for my ignorance but what is a getresubstrings
        Message 3 of 21 , Dec 5, 2009
        • 0 Attachment
          Sorry for my ignorance but what is a getresubstrings



          --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
          >
          > errr this:
          > (?s)^(% \R.*?\( )(.*?)( \)\RM30)\R
          >
          > Sorry stopped one short of full thought there.
          >
          > Don - HtmlFixIt.com wrote:
          > > Try this data pattern along with getresubstrings and I think you have it:
          > > (?s)^(% \R.*?\( )(SF 49A)( \)\RM30)\R
          > >
          > > Don - HtmlFixIt.com wrote:
          > >> Of course .... if we understand what we are doing and the data pattern.
          > >>
          > >> Is there always a return followed by a % to start each file?
          > >> Is the "filename" always the second from last line, followed by a bunch
          > >> of blank lines?
          > >>
          > >> Is there always an M30 on the last line of each file?
          > >
          >
        • Axel Berger
          ... Hmm, let s see: Clip Help -- search -- getresubstrings -- one topic If you do a Regex find with more than one group in round brackets () you can then
          Message 4 of 21 , Dec 6, 2009
          • 0 Attachment
            bozlawless wrote:
            > but what is a getresubstrings

            Hmm, let's see:
            Clip Help --> search --> "getresubstrings" --> one topic

            If you do a Regex find with more than one group in round brackets () you
            can then define an Array as:

            ^!SetArray %Array%=^$GetReSubStrings$

            After that ^%Array0% will contain the number of elements (brackets) and
            ^%Array1% and and up will contain what has been found inside those
            marked groups.

            Axel
          • Don - HtmlFixIt.com
            Thanks Axel, This is a very good explanation of what is getresubstrings. Help or more particularly help on help on clip programming is your friend. I use
            Message 5 of 21 , Dec 6, 2009
            • 0 Attachment
              Thanks Axel,

              This is a very good explanation of what is getresubstrings. Help or
              more particularly help on "help on clip programming" is your friend. I
              use the search function regularly in that help "file".

              Here is the problem -- and it's a common one with questions such as this:

              1. the answer is absolutely yes it can be done
              2. the solution is completely dependent on the following:
              a. what does the input look like ... you gave use three examples
              that appear to be the same at the start and finish ... I say is that
              common and you say no ... well if I take (took) the time to craft a
              solution and in fact the data is not representative, then we have
              achieved nothing. I need to know what is the same for every single
              file; and
              b. what should the output look like - I'm assuming you want
              everything from % to M30 to be in a new file named after the "filename"
              you choose, but you didn't say. If all you want to do is capture the
              filename (Was that your only question?) well then just take the last
              part of that find and you have it.

              So yes we can help, but you didn't really give us enough to answer well.

              I hope that is helpful and all makes sense.

              Don

              Axel Berger wrote:
              > bozlawless wrote:
              >> but what is a getresubstrings
              >
              > Hmm, let's see:
              > Clip Help --> search --> "getresubstrings" --> one topic
              >
              > If you do a Regex find with more than one group in round brackets () you
              > can then define an Array as:
              >
              > ^!SetArray %Array%=^$GetReSubStrings$
              >
              > After that ^%Array0% will contain the number of elements (brackets) and
              > ^%Array1% and and up will contain what has been found inside those
              > marked groups.
              >
              > Axel
              >
              >
              > ------------------------------------
              >
              > Fookes Software: http://www.fookes.com/
              > NoteTab website: http://www.notetab.com/
              > NoteTab Discussion Lists: http://www.notetab.com/groups.php
              >
              > ***
              > Yahoo! Groups Links
              >
              >
              >
              >
            • Axel Berger
              ... You have put that in a nutshell Don. Really understanding and conceptualizing the problem is art, translating that into code mere craft. This fact goes for
              Message 6 of 21 , Dec 6, 2009
              • 0 Attachment
                "Don - HtmlFixIt.com" wrote:
                > but you didn't really give us enough

                You have put that in a nutshell Don. Really understanding and
                conceptualizing the problem is art, translating that into code mere
                craft.

                This fact goes for many areas in science and life.

                Axel
              • bozlawless
                Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes 1. Create a file from O#### to M30 2. The file name
                Message 7 of 21 , Dec 6, 2009
                • 0 Attachment
                  Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes

                  1. Create a file from O#### to M30

                  2. The file name needs to be same as line just before M30 (FILENAME)

                  3. I don't have any input other than open the master file

                  4. Yes all files will look like this other than the O#### (INFO ) at the start and the name just before the M30

                  I pray that is helpful and makes sense

                  Thank you to everyone who is helping me on this
                  Mike


                  --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                  >
                  > Thanks Axel,
                  >
                  > This is a very good explanation of what is getresubstrings. Help or
                  > more particularly help on "help on clip programming" is your friend. I
                  > use the search function regularly in that help "file".
                  >
                  > Here is the problem -- and it's a common one with questions such as this:
                  >
                  > 1. the answer is absolutely yes it can be done
                  > 2. the solution is completely dependent on the following:
                  > a. what does the input look like ... you gave use three examples
                  > that appear to be the same at the start and finish ... I say is that
                  > common and you say no ... well if I take (took) the time to craft a
                  > solution and in fact the data is not representative, then we have
                  > achieved nothing. I need to know what is the same for every single
                  > file; and
                  > b. what should the output look like - I'm assuming you want
                  > everything from % to M30 to be in a new file named after the "filename"
                  > you choose, but you didn't say. If all you want to do is capture the
                  > filename (Was that your only question?) well then just take the last
                  > part of that find and you have it.
                  >
                  > So yes we can help, but you didn't really give us enough to answer well.
                  >
                  > I hope that is helpful and all makes sense.
                  >
                  > Don
                  >
                  > Axel Berger wrote:
                  > > bozlawless wrote:
                  > >> but what is a getresubstrings
                  > >
                  > > Hmm, let's see:
                  > > Clip Help --> search --> "getresubstrings" --> one topic
                  > >
                  > > If you do a Regex find with more than one group in round brackets () you
                  > > can then define an Array as:
                  > >
                  > > ^!SetArray %Array%=^$GetReSubStrings$
                  > >
                  > > After that ^%Array0% will contain the number of elements (brackets) and
                  > > ^%Array1% and and up will contain what has been found inside those
                  > > marked groups.
                  > >
                  > > Axel
                  > >
                  > >
                  > > ------------------------------------
                  > >
                  > > Fookes Software: http://www.fookes.com/
                  > > NoteTab website: http://www.notetab.com/
                  > > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                  > >
                  > > ***
                  > > Yahoo! Groups Links
                  > >
                  > >
                  > >
                  > >
                  >
                • bozlawless
                  Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes 1. Create a file from O#### to M30 2. The file name
                  Message 8 of 21 , Dec 6, 2009
                  • 0 Attachment
                    Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes

                    1. Create a file from O#### to M30

                    2. The file name needs to be same as line just before M30 (FILENAME)

                    3. I don't have any input other than open the master file

                    4. Yes all files will look like this other than the O#### (INFO ) at the start and the name just before the M30

                    I pray that is helpful and makes sense

                    Thank you to everyone who is helping me on this
                    Mike


                    --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                    >
                    > Thanks Axel,
                    >
                    > This is a very good explanation of what is getresubstrings. Help or
                    > more particularly help on "help on clip programming" is your friend. I
                    > use the search function regularly in that help "file".
                    >
                    > Here is the problem -- and it's a common one with questions such as this:
                    >
                    > 1. the answer is absolutely yes it can be done
                    > 2. the solution is completely dependent on the following:
                    > a. what does the input look like ... you gave use three examples
                    > that appear to be the same at the start and finish ... I say is that
                    > common and you say no ... well if I take (took) the time to craft a
                    > solution and in fact the data is not representative, then we have
                    > achieved nothing. I need to know what is the same for every single
                    > file; and
                    > b. what should the output look like - I'm assuming you want
                    > everything from % to M30 to be in a new file named after the "filename"
                    > you choose, but you didn't say. If all you want to do is capture the
                    > filename (Was that your only question?) well then just take the last
                    > part of that find and you have it.
                    >
                    > So yes we can help, but you didn't really give us enough to answer well.
                    >
                    > I hope that is helpful and all makes sense.
                    >
                    > Don
                    >
                    > Axel Berger wrote:
                    > > bozlawless wrote:
                    > >> but what is a getresubstrings
                    > >
                    > > Hmm, let's see:
                    > > Clip Help --> search --> "getresubstrings" --> one topic
                    > >
                    > > If you do a Regex find with more than one group in round brackets () you
                    > > can then define an Array as:
                    > >
                    > > ^!SetArray %Array%=^$GetReSubStrings$
                    > >
                    > > After that ^%Array0% will contain the number of elements (brackets) and
                    > > ^%Array1% and and up will contain what has been found inside those
                    > > marked groups.
                    > >
                    > > Axel
                    > >
                    > >
                    > > ------------------------------------
                    > >
                    > > Fookes Software: http://www.fookes.com/
                    > > NoteTab website: http://www.notetab.com/
                    > > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    > >
                    > > ***
                    > > Yahoo! Groups Links
                    > >
                    > >
                    > >
                    > >
                    >
                  • bozlawless
                    Thanks AXEL
                    Message 9 of 21 , Dec 6, 2009
                    • 0 Attachment
                      Thanks AXEL

                      --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                      >
                      > bozlawless wrote:
                      > > but what is a getresubstrings
                      >
                      > Hmm, let's see:
                      > Clip Help --> search --> "getresubstrings" --> one topic
                      >
                      > If you do a Regex find with more than one group in round brackets () you
                      > can then define an Array as:
                      >
                      > ^!SetArray %Array%=^$GetReSubStrings$
                      >
                      > After that ^%Array0% will contain the number of elements (brackets) and
                      > ^%Array1% and and up will contain what has been found inside those
                      > marked groups.
                      >
                      > Axel
                      >
                    • Don - HtmlFixIt.com
                      I that an alphabetic Ohh and not a numberic zero? There are always four numbers after it? That always starts every single file data set and M30 ends every
                      Message 10 of 21 , Dec 6, 2009
                      • 0 Attachment
                        I that an alphabetic Ohh and not a numberic zero?
                        There are always four numbers after it?
                        That always starts every single "file" data set and M30 ends every
                        single file data set?

                        Ohhh#### never appears at the start of any line except for the first
                        line of a data set?

                        bozlawless wrote:
                        > Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes
                        >
                        > 1. Create a file from O#### to M30
                        >
                        > 2. The file name needs to be same as line just before M30 (FILENAME)
                        >
                        > 3. I don't have any input other than open the master file
                        >
                        > 4. Yes all files will look like this other than the O#### (INFO ) at the start and the name just before the M30
                        >
                        > I pray that is helpful and makes sense
                        >
                        > Thank you to everyone who is helping me on this
                        > Mike
                      • flo.gehrke
                        ... Mike, Open your Master File and start the following clip. It will split the text you ve sent to the group into three parts. Each part is saved in a
                        Message 11 of 21 , Dec 6, 2009
                        • 0 Attachment
                          --- In ntb-clips@yahoogroups.com, "bozlawless" <bozlawless@...> wrote:
                          >
                          > Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes
                          >
                          > 1. Create a file from O#### to M30
                          >
                          > 2. The file name needs to be same as line just before M30 (FILENAME)
                          >
                          > 3. I don't have any input other than open the master file
                          >
                          > 4. Yes all files will look like this other than the O#### (INFO ) at the start and the name just before the M30
                          >
                          > I pray that is helpful and makes sense
                          >
                          > Thank you to everyone who is helping me on this
                          > Mike

                          Mike,

                          Open your "Master File" and start the following clip. It will split the text you've sent to the group into three parts. Each part is saved in a separate file. So you will get three files named SF 49A.txt, RPM 31C.txt, and SSR 105A.txt.


                          ;^!SetScreenUpdate Off
                          ^!Jump 1
                          :Loop
                          ^!Find "^O\d{4}\C+?M30$" RS
                          ^!IfError End
                          ^!SetClipboard ^$GetSelection$
                          ^!Jump Select_End
                          ^!Jump -1
                          ^!Find "^\(\x20\K.+(?=\x20\))" RS
                          ^!Set %Name%="^$GetSelection$.txt"
                          ^!TextToFile "^$GetDocumentPath$^%Name%" ^$GetClipboard$
                          ^!Goto Loop


                          I hope this will meet your intentions.

                          Regards,
                          Flo
                        • bozlawless
                          yes alphabetic Ohh starts every time and yes four numbers after it and it always ends with M30
                          Message 12 of 21 , Dec 6, 2009
                          • 0 Attachment
                            yes alphabetic Ohh starts every time and yes four numbers after it and it always ends with M30


                            --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                            >
                            > I that an alphabetic Ohh and not a numberic zero?
                            > There are always four numbers after it?
                            > That always starts every single "file" data set and M30 ends every
                            > single file data set?
                            >
                            > Ohhh#### never appears at the start of any line except for the first
                            > line of a data set?
                            >
                            > bozlawless wrote:
                            > > Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes
                            > >
                            > > 1. Create a file from O#### to M30
                            > >
                            > > 2. The file name needs to be same as line just before M30 (FILENAME)
                            > >
                            > > 3. I don't have any input other than open the master file
                            > >
                            > > 4. Yes all files will look like this other than the O#### (INFO ) at the start and the name just before the M30
                            > >
                            > > I pray that is helpful and makes sense
                            > >
                            > > Thank you to everyone who is helping me on this
                            > > Mike
                            >
                          • bozlawless
                            no not always a % at the start but always a O#### that is the leter O followed by four numbers the filename is always before M30 second line from last line
                            Message 13 of 21 , Dec 6, 2009
                            • 0 Attachment
                              no not always a % at the start but always a O#### that is the leter O followed by four numbers

                              the "filename" is always before M30 second line from last line




                              --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                              >
                              > Of course .... if we understand what we are doing and the data pattern.
                              >
                              > Is there always a return followed by a % to start each file?
                              > Is the "filename" always the second from last line, followed by a bunch
                              > of blank lines?
                              >
                              > Is there always an M30 on the last line of each file?
                              >
                            • bozlawless
                              i ran it not sure were it saved them to when it was running it gave me a I/O ERROR
                              Message 14 of 21 , Dec 6, 2009
                              • 0 Attachment
                                i ran it not sure were it saved them to when it was running it gave me a I/O ERROR



                                --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
                                >
                                > --- In ntb-clips@yahoogroups.com, "bozlawless" <bozlawless@> wrote:
                                > >
                                > > Hey sorry its hard for me to convey thru cyberspace what i want sometimes also in life but here goes
                                > >
                                > > 1. Create a file from O#### to M30
                                > >
                                > > 2. The file name needs to be same as line just before M30 (FILENAME)
                                > >
                                > > 3. I don't have any input other than open the master file
                                > >
                                > > 4. Yes all files will look like this other than the O#### (INFO ) at the start and the name just before the M30
                                > >
                                > > I pray that is helpful and makes sense
                                > >
                                > > Thank you to everyone who is helping me on this
                                > > Mike
                                >
                                > Mike,
                                >
                                > Open your "Master File" and start the following clip. It will split the text you've sent to the group into three parts. Each part is saved in a separate file. So you will get three files named SF 49A.txt, RPM 31C.txt, and SSR 105A.txt.
                                >
                                >
                                > ;^!SetScreenUpdate Off
                                > ^!Jump 1
                                > :Loop
                                > ^!Find "^O\d{4}\C+?M30$" RS
                                > ^!IfError End
                                > ^!SetClipboard ^$GetSelection$
                                > ^!Jump Select_End
                                > ^!Jump -1
                                > ^!Find "^\(\x20\K.+(?=\x20\))" RS
                                > ^!Set %Name%="^$GetSelection$.txt"
                                > ^!TextToFile "^$GetDocumentPath$^%Name%" ^$GetClipboard$
                                > ^!Goto Loop
                                >
                                >
                                > I hope this will meet your intentions.
                                >
                                > Regards,
                                > Flo
                                >
                              • flo.gehrke
                                ... I ve tested with NT Pro 6.12. What s your NT version? Flo
                                Message 15 of 21 , Dec 6, 2009
                                • 0 Attachment
                                  --- In ntb-clips@yahoogroups.com, "bozlawless" <bozlawless@...> wrote:
                                  >
                                  > i ran it not sure were it saved them to when it was running it gave
                                  > me a I/O ERROR

                                  I've tested with NT Pro 6.12. What's your NT version?

                                  Flo
                                • bozlawless
                                  ver 6.12 i sent you more info
                                  Message 16 of 21 , Dec 6, 2009
                                  • 0 Attachment
                                    ver 6.12 i sent you more info

                                    --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
                                    >
                                    > --- In ntb-clips@yahoogroups.com, "bozlawless" <bozlawless@> wrote:
                                    > >
                                    > > i ran it not sure were it saved them to when it was running it gave
                                    > > me a I/O ERROR
                                    >
                                    > I've tested with NT Pro 6.12. What's your NT version?
                                    >
                                    > Flo
                                    >
                                  • flo.gehrke
                                    ... Mike, There s a problem with your data. You wrote... 1. that the line before M30 is containing the string that serves as the file name. 2. that this line
                                    Message 17 of 21 , Dec 6, 2009
                                    • 0 Attachment
                                      --- In ntb-clips@yahoogroups.com, "bozlawless" <bozlawless@...> wrote:
                                      >
                                      > ver 6.12 i sent you more info
                                      >

                                      Mike,

                                      There's a problem with your data. You wrote...

                                      1. that the line before "M30" is containing the string that serves as the file name.

                                      2. that this line has a format like '( SF 240B )'. But that's not the case in all those lines. Consequently, the clip captures another line that doesn't comply with the rules of correct file names. This ends up in an I/O Error.

                                      You may run the following clip in order to see what those lines in question actually contain:


                                      ^!Jump 1

                                      :Loop
                                      ^!Find "^M30" RS
                                      ^!IfError End
                                      ^!Set %Adr%=^$GetLine(-1)$
                                      ^!Append %List%=^%Adr%^%NL%
                                      ^!Goto Loop

                                      :End
                                      ^!Toolbar New Document
                                      ^!InsertText ^%List%
                                      ^!ClearVariable %List%

                                      For example: See the following lines...

                                      N84G28U0
                                      T0101
                                      M30

                                      O0303

                                      As you can see, the line before 'M30' has a format that doesn't accord with the format you described.

                                      So it's up to you to clean your data or to give us a precise description of all possible formats of this line containing the file name.

                                      Regards,
                                      Flo
                                    • bozlawless
                                      Flo thanks for your help i cleaned up my master file and put a name above all the M30 but it is still stopping at O1232 AND O1518 When i cleaned up my
                                      Message 18 of 21 , Dec 7, 2009
                                      • 0 Attachment
                                        Flo thanks for your help i cleaned up my "master file" and put a name above all the M30 but it is still stopping at O1232 AND O1518

                                        When i cleaned up my "master file" and run your second clip it spits out a text file and shoes all the names are good


                                        Thanks
                                        Mike

                                        --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
                                        >
                                        > --- In ntb-clips@yahoogroups.com, "bozlawless" <bozlawless@> wrote:
                                        > >
                                        > > ver 6.12 i sent you more info
                                        > >
                                        >
                                        > Mike,
                                        >
                                        > There's a problem with your data. You wrote...
                                        >
                                        > 1. that the line before "M30" is containing the string that serves as the file name.
                                        >
                                        > 2. that this line has a format like '( SF 240B )'. But that's not the case in all those lines. Consequently, the clip captures another line that doesn't comply with the rules of correct file names. This ends up in an I/O Error.
                                        >
                                        > You may run the following clip in order to see what those lines in question actually contain:
                                        >
                                        >
                                        > ^!Jump 1
                                        >
                                        > :Loop
                                        > ^!Find "^M30" RS
                                        > ^!IfError End
                                        > ^!Set %Adr%=^$GetLine(-1)$
                                        > ^!Append %List%=^%Adr%^%NL%
                                        > ^!Goto Loop
                                        >
                                        > :End
                                        > ^!Toolbar New Document
                                        > ^!InsertText ^%List%
                                        > ^!ClearVariable %List%
                                        >
                                        > For example: See the following lines...
                                        >
                                        > N84G28U0
                                        > T0101
                                        > M30
                                        >
                                        > O0303
                                        >
                                        > As you can see, the line before 'M30' has a format that doesn't accord with the format you described.
                                        >
                                        > So it's up to you to clean your data or to give us a precise description of all possible formats of this line containing the file name.
                                        >
                                        > Regards,
                                        > Flo
                                        >
                                      Your message has been successfully submitted and would be delivered to recipients shortly.