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

sorting an array

Expand Messages
  • Don - HtmlFixIt.com
    have we written this clip yet ... or is there a function ... Want to take an array like: one;two;two;three;five;four;two and come up with this in the end
    Message 1 of 25 , Mar 29, 2009
    • 0 Attachment
      have we written this clip yet ... or is there a function ...

      Want to take an array like:
      one;two;two;three;five;four;two

      and come up with this in the end
      five;four;one;three;two

      removed dups and put it alpha order
      delimiter is actually a tab
    • Hugo Paulissen
      Hi Don, ^!SetArray %Array%=one;two;three;four;five;four ^!SetArray %SortArray%=^$StrSort( ^$StrReplace( ; ; ^p ; ^%Array% ;1;0)$ ;0;1;1)$ ^!SetArray
      Message 2 of 25 , Mar 30, 2009
      • 0 Attachment
        Hi Don,

        ^!SetArray %Array%=one;two;three;four;five;four
        ^!SetArray %SortArray%=^$StrSort("^$StrReplace(";";"^p";"^%Array%";1;0)$";0;1;1)$
        ^!SetArray %SortArray%=^$StrSort("^$StrReplace("^p";";";"^%SortArray%";1;0)$";0;1;1)$
        ^!Info ^%Array% ^P ^%SortArray%

        Hugo




        ________________________________
        From: Don - HtmlFixIt.com <don@...>
        To: ntb-clips@yahoogroups.com
        Sent: Monday, March 30, 2009 7:58:36 AM
        Subject: [Clip] sorting an array


        have we written this clip yet ... or is there a function ...

        Want to take an array like:
        one;two;two; three;five; four;two

        and come up with this in the end
        five;four;one; three;two

        removed dups and put it alpha order
        delimiter is actually a tab






        [Non-text portions of this message have been removed]
      • Don - HtmlFixIt.com
        I asked last week about doing this ... one perl suggestion and not much else ... how do we sort arrays?
        Message 3 of 25 , Jun 30, 2009
        • 0 Attachment
          I asked last week about doing this ... one perl suggestion and not much
          else ... how do we sort arrays?
        • Sheri
          ... Have you tried ^$strsort$?
          Message 4 of 25 , Jun 30, 2009
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
            >
            > I asked last week about doing this ... one perl suggestion and
            > not much else ... how do we sort arrays?

            Have you tried ^$strsort$?
          • Don - HtmlFixIt.com
            Can I use string sort on an array without first putting it in a document? Is there a way to simply sort the array? My first question was fairly detailed,
            Message 5 of 25 , Jun 30, 2009
            • 0 Attachment
              Can I use string sort on an array without first putting it in a
              document? Is there a way to simply sort the array?

              My first question was fairly detailed, perhaps too detailed as I got
              virtually no response.

              I read this in help:
              "^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$ (added in v4.52)

              Returns the specified text "Str" sorted according to the defined
              criteria. NoteTab 5 supports two new values for the CaseSensitive
              parameter: ANSI to enforce a case sensitive dictionary-type sorting
              order and False_ANSI to ignore character case during sorting. The ANSI
              option produces a sorting order that matches the result from the
              Modify/Lines/Sort menu command. Note, however, that sorting is much
              slower with the ANSI option.

              For example, the following instruction will sort the lines contained in
              the Clipboard, in ascending order, ignoring character case, and removing
              duplicates:

              ^$StrSort("^$GetClipboard$";False;True;True)$"

              It leads me to believe that I need to have my search terms in a document
              with one term per line ... meaning that my array needs to be broken out,
              put in a new document, sorted, then reassembled back into my array ...
              is that correct?

              I also had to zero pad my array numbers to get them sorted correctly.

              I do have it sorting using strsort in a dummy document, but then when I
              kill that document, I am not returning to the document I was intending
              to be working in ... so next I have to work on that ... a whole lot of
              work for a simple array sort it seems, so I figure I must be missing
              something.

              Sheri wrote:
              > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
              >> I asked last week about doing this ... one perl suggestion and
              >> not much else ... how do we sort arrays?
              >
              > Have you tried ^$strsort$?
              >
              >
              >
              >
              > ------------------------------------
              >
              > Fookes Software: http://www.fookes.com/
              > NoteTab website: http://www.notetab.com/
              > NoteTab Discussion Lists: http://www.notetab.com/groups.php
              >
              > ***
              > Yahoo! Groups Links
              >
              >
              >
              >
            • Sheri
              ... AFAIK a notetab array is simply a delimited string.
              Message 6 of 25 , Jun 30, 2009
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                >
                > Can I use string sort on an array without first putting it in a
                > document? Is there a way to simply sort the array?
                >

                AFAIK a notetab array is simply a delimited string.
              • Don - HtmlFixIt.com
                can it be sorted on the clipboard without opening a new document?
                Message 7 of 25 , Jun 30, 2009
                • 0 Attachment
                  can it be sorted on the clipboard without opening a new document?

                  Sheri wrote:
                  > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                  >> Can I use string sort on an array without first putting it in a
                  >> document? Is there a way to simply sort the array?
                  >>
                  >
                  > AFAIK a notetab array is simply a delimited string.
                  >
                • Sheri
                  ... Look up ^$strsort$ in the help file. Something like: ^!SetArray %sorted%=^$StrSort( ^%unsorted% ;options)$ You can probably set the same array, if that s
                  Message 8 of 25 , Jun 30, 2009
                  • 0 Attachment
                    --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                    >
                    > can it be sorted on the clipboard without opening a new document?
                    >
                    > Sheri wrote:
                    > > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@> wrote:
                    > >> Can I use string sort on an array without first putting it in a
                    > >> document? Is there a way to simply sort the array?
                    > >>
                    > >
                    > > AFAIK a notetab array is simply a delimited string.
                    > >
                    >

                    Look up ^$strsort$ in the help file.

                    Something like:

                    ^!SetArray %sorted%=^$StrSort("^%unsorted%";options)$

                    You can probably set the same array, if that's what you're asking (untried).

                    Regards,
                    Sheri
                  • Don - HtmlFixIt.com
                    Nah, I was hoping it would sort based on the delimited data (seems like a reasonable function) ... ^!Toolbar New Document ^!InsertText 12;03;15;99;24;5;54;50
                    Message 9 of 25 , Jun 30, 2009
                    • 0 Attachment
                      Nah, I was hoping it would sort based on the delimited data (seems like
                      a reasonable function) ...
                      ^!Toolbar New Document
                      ^!InsertText 12;03;15;99;24;5;54;50
                      ^!Select All
                      ^!SetArray %new%="^$StrSort("^$GetSelection$";No;Yes;No)$"
                      ^!Info [C]^%new%

                      not sorted ...
                      12;03;15;99;24;5;54;50

                      ^!Toolbar New Document
                      ^!InsertText 12;03;15;99;24;5;54;50
                      ^!Replace ";" >> "^P" ACIWS
                      ^!Select All
                      ^!SetClipboard ^$GetSelection$
                      ^!SetArray %new%="^$StrSort("^$GetClipboard$";No;Yes;No)$"
                      ^!Info [C]^%new%

                      sorted but have ^P between each ...
                      03
                      12
                      15
                      24
                      5
                      50
                      54
                      99

                      I think I can then put the clipboard into a variable and replace the
                      ^P's with semi-colons (my preferred delimiter in this case) and be off
                      to the races.

                      At least doing it on the clipboard is much easier than doing it in a new
                      document I guess.



                      Sheri wrote:
                      > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                      >> can it be sorted on the clipboard without opening a new document?
                      >>
                      >> Sheri wrote:
                      >>> --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@> wrote:
                      >>>> Can I use string sort on an array without first putting it in a
                      >>>> document? Is there a way to simply sort the array?
                      >>>>
                      >>> AFAIK a notetab array is simply a delimited string.
                      >>>
                      >
                      > Look up ^$strsort$ in the help file.
                      >
                      > Something like:
                      >
                      > ^!SetArray %sorted%=^$StrSort("^%unsorted%";options)$
                      >
                      > You can probably set the same array, if that's what you're asking (untried).
                      >
                      > Regards,
                      > Sheri
                      >
                      >
                      >
                      >
                      > ------------------------------------
                      >
                      > Fookes Software: http://www.fookes.com/
                      > NoteTab website: http://www.notetab.com/
                      > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                      >
                      > ***
                      > Yahoo! Groups Links
                      >
                      >
                      >
                      >
                    • Don - HtmlFixIt.com
                      cooking with gas now ... just need to turn up the heat: ^!Toolbar New Document ^!InsertText 12;03;15;99;24;5;54;50 ^!Replace ; ^P ACIWS ^!Select All
                      Message 10 of 25 , Jun 30, 2009
                      • 0 Attachment
                        cooking with gas now ... just need to turn up the heat:

                        ^!Toolbar New Document
                        ^!InsertText 12;03;15;99;24;5;54;50
                        ^!Replace ";" >> "^P" ACIWS
                        ^!Select All
                        ^!SetClipboard ^$GetSelection$
                        ^!SetClipboard=^$StrSort("^$GetClipboard$";No;Yes;No)$
                        ^!SetArray %new%=^$StrReplace("^P";";";"^$GetClipboard$";0;0)$


                        ^!Info [C]^%new%

                        gives us
                        03;12;15;24;5;50;54;99

                        Need to zero pad my 5 of course ... but otherwise doing good.
                      • Don - HtmlFixIt.com
                        ^!SetClipboard=^$StrSort( ^$StrReplace( ; ; ^P ; 12;03;15;99;24;05;54;50 ;0;0)$ ;No;Yes;No)$ ^!SetArray %new%=^$StrReplace( ^P ; ; ; ^$GetClipboard$ ;0;0)$
                        Message 11 of 25 , Jun 30, 2009
                        • 0 Attachment
                          ^!SetClipboard=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                          ^!SetArray %new%=^$StrReplace("^P";";";"^$GetClipboard$";0;0)$

                          ^!Info [C]^%new%

                          03;05;12;15;24;50;54;99

                          If I were willing to use ^P as delimiters think I can get it down to one
                          line.

                          ^!SetArray
                          %new%=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                        • Alec Burgess
                          Don - HtmlFixIt.com (don@htmlfixit.com) wrote (in part) (on 2009-07-01 ... ew%=^$StrReplace( ^P ; ; ; ^$GetClipboard$ ;0;0)$ ... ew% ... Don: you don t really
                          Message 12 of 25 , Jun 30, 2009
                          • 0 Attachment
                            Don - HtmlFixIt.com (don@...) wrote (in part) (on 2009-07-01
                            at 00:22):
                            > cooking with gas now ... just need to turn up the heat:
                            >
                            > ^!Toolbar New Document
                            > ^!InsertText 12;03;15;99;24;5;54;50
                            > ^!Replace ";" >> "^P" ACIWS
                            > ^!Select All
                            > ^!SetClipboard ^$GetSelection$
                            > ^!SetClipboard=^$StrSort("^$GetClipboard$";No;Yes;No)$
                            > ^!SetArray
                            ew%=^$StrReplace("^P";";";"^$GetClipboard$";0;0)$
                            >
                            > ^!Info [C]^
                            ew%
                            >
                            > gives us
                            > 03;12;15;24;5;50;54;99
                            >
                            > Need to zero pad my 5 of course ... but otherwise doing good.

                            Don: you don't really need to use either clipboard OR work document OR
                            arrays
                            ie:
                            ^!set %dataSemiUnsorted%=12;03;15;99;24;5;54;50
                            ^!set %dataCrUnsorted%=^$StrReplace(";";"^P";"^%dataSemiUnsorted%";NO;NO)$
                            ^!set %dataCrSorted%=^$StrSort("^%dataCrUnsorted%";yes;yes;yes)$
                            ^!set %dataSemiSorted%=^$StrReplace("^P";";";"^%dataCrSorted%";NO;NO)$
                            ^!info %dataSemiSorted%=^%dataSemiSorted%

                            the info at end shows:
                            %dataSemiSorted%=03;12;15;24;5;50;54;99

                            The above could be reduced to one statement with nested functions but I
                            used separate variables to make it easier to debug :-)

                            However ... with your work document solution, while the document
                            contains the unpadded ^P-delimited lines you can pad them (assuming no
                            number is more than 3 digits) with:
                            ^!replace "^" >> "000" rwais
                            then strip to 3 digits right-justified
                            ^!replace ^0*(\d{3})" >> $1 rwais

                            I thought I remembered Eric having provided a variant of ^$StrReplace()$
                            which would support a regex replace but all I can find now is
                            ^$GetDocReplaceAll("SearchPattern";"ReplaceString")$ which is the
                            equivalent of a replace statement with options "rwais".

                            If the function I was looking for existed you could do the
                            padding-unpadding on either %dataCrUnsorted% or %dataCrSorted% in the
                            above clip fragment.--

                            Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)




                            [Non-text portions of this message have been removed]
                          • Alec Burgess
                            Don ... our messages crossed each other. You are saying much the same as I did below -) Don - HtmlFixIt.com (don@htmlfixit.com) wrote (in part) (on
                            Message 13 of 25 , Jun 30, 2009
                            • 0 Attachment
                              Don ... our messages crossed each other. You are saying much the same as
                              I did below "-)

                              Don - HtmlFixIt.com (don@...) wrote (in part) (on 2009-07-01
                              at 00:30):
                              >
                              ^!SetClipboard=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                              > ^!SetArray
                              ew%=^$StrReplace("^P";";";"^$GetClipboard$";0;0)$
                              >
                              > ^!Info [C]^
                              ew%
                              >
                              > 03;05;12;15;24;50;54;99
                              >
                              > If I were willing to use ^P as delimiters think I can get it down to
                              > one
                              > line.
                              >
                              > ^!SetArray
                              >
                              ew%=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$

                              --
                              Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)




                              [Non-text portions of this message have been removed]
                            • Sheri
                              Strange. I expected ^$StrSort$ would respond to a delimiter set by ^!SetListDelimiter but it seems it is strictly a line sorting function. Same thing in 4.95,
                              Message 14 of 25 , Jul 1 5:14 AM
                              • 0 Attachment
                                Strange. I expected ^$StrSort$ would respond to a delimiter set by ^!SetListDelimiter but it seems it is strictly a line sorting function. Same thing in 4.95, so not the result of changes since then.

                                Regards,
                                Sheri
                              • Don - HtmlFixIt.com
                                Yes but you emphasized that I can just do it on a variable (with replacement of the default delimiter -- a semi-colon -- for the ^P as string sort works on
                                Message 15 of 25 , Jul 1 5:17 AM
                                • 0 Attachment
                                  Yes but you emphasized that I can just do it on a variable (with
                                  replacement of the default delimiter -- a semi-colon -- for the ^P as
                                  string sort works on lines of text). While I said it ... I guess it
                                  didn't totally sink in :-)

                                  Help is only kind of helpful on strsort. Much like Math, some examples
                                  would be helpful -- as the example in clip help uses the clipboard and
                                  refers to sorting like the menu sort (which was why I was thinking of a
                                  work document or clipboard when neither is necessary). It honestly
                                  didn't occur to me to try it on a variable. What I didn't want to do
                                  was to sort my entire document because that isn't the object I am
                                  working on.

                                  I already have zero padding handled actually as my array is built zero
                                  padded by my prior code, so that is no worry at this time.

                                  This is code we developed a while back:
                                  ^$StrCopyRight("0000^%PlaceStart%";4)$

                                  Here is my actual array build -- a little more to it. Each array
                                  element has four sub-elements in actuality.

                                  :BuildArray
                                  ;superlonglinefollows
                                  ^!SetArray
                                  %fielddynamics%=^$StrCopyRight("0000^%PlaceStart%";4)$:^%PlaceCount%:^$Calc(^%PlaceStart%+^%PlaceCount%)$:Place;^$StrCopyRight("0000^%NameStart%";4)$:^%NameCount%:^$Calc(^%NameStart%+^%NameCount%)$:Name;^$StrCopyRight("0000^%SchoolStart%";4)$:^%SchoolCount%:^$Calc(^%SchoolStart%+^%SchoolCount%)$:School;^$StrCopyRight("0000^%GradeStart%";4)$:^%GradeCount%:^$Calc(^%GradeStart%+^%GradeCount%)$:Grade;^$StrCopyRight("0000^%TimeStart%";4)$:^%TimeCount%:^$Calc(^%TimeStart%+^%TimeCount%)$:Time

                                  I am now on to the next step which is building a regex statement out of
                                  this ...

                                  More on that in a different email perhaps :-)

                                  Your post was most helpful as were Sheri's! Sometimes saying the same
                                  thing (even if not crossing like ours) re-emphasizes and clarifies and
                                  yours did that for me.

                                  I think I still need to sort it out of an array and then put it back in
                                  the array because an array at zero had the number of elements. However
                                  if you use ^%array% I think you get the array sans the zero element ...

                                  So I think the following may work.

                                  ^!SetArray
                                  %new%=^$StrSort("^$StrReplace(";";"^P";"^%new%";0;0)$";No;Yes;No)$


                                  Alec Burgess wrote:
                                  > Don ... our messages crossed each other. You are saying much the same as
                                  > I did below "-)
                                  >
                                  > Don - HtmlFixIt.com (don@...) wrote (in part) (on 2009-07-01
                                  > at 00:30):
                                  > ^!SetClipboard=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                                  >> ^!SetArray
                                  > ew%=^$StrReplace("^P";";";"^$GetClipboard$";0;0)$
                                  >> ^!Info [C]^
                                  > ew%
                                  >> 03;05;12;15;24;50;54;99
                                  >>
                                  >> If I were willing to use ^P as delimiters think I can get it down to
                                  >> one
                                  >> line.
                                  >>
                                  >> ^!SetArray
                                  >>
                                  > ew%=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                                  >
                                • Jeff
                                  You can use an clip to rearrange the elements of an array, like was done to make the surnames first clip I am working on (and still can t get to work after a
                                  Message 16 of 25 , Jul 1 6:10 AM
                                  • 0 Attachment
                                    You can use an clip to rearrange the elements of an array, like was done
                                    to make the surnames first clip I am working on (and still can't get to
                                    work after a year of trying. I can't grasp the seemingly simple
                                    concepts...really need help) can the elements of the array be
                                    rearranged, sorted then rearranged into the desired order?

                                    Jeff

                                    Sheri wrote:
                                    >
                                    >
                                    > Strange. I expected ^$StrSort$ would respond to a delimiter set by
                                    > ^!SetListDelimiter but it seems it is strictly a line sorting
                                    > function. Same thing in 4.95, so not the result of changes since then.
                                    >
                                    > Regards,
                                    > Sheri
                                    >
                                    >
                                    > ------------------------------------------------------------------------
                                    >
                                    >
                                    > No virus found in this incoming message.
                                    > Checked by AVG - www.avg.com
                                    > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00
                                    >
                                    >

                                    --


                                    Jeffery G. Scism, IBSSG
                                    Flockmaster,
                                    International Blacksheep Society of Genealogists

                                    http://ibssg.org/blacksheep/

                                    http://bsmeadow.blogspot.com/ Blacksheep's Meadow

                                    http://www.flickr.com/photos/7764576@N05/ Photostream
                                  • Jeff
                                    Don - HtmlFixIt.com wrote: What I didn t want to do was to sort my entire document because that isn t the object I am working on. can you cut the piece to a
                                    Message 17 of 25 , Jul 1 6:12 AM
                                    • 0 Attachment
                                      Don - HtmlFixIt.com wrote:
                                      What I didn't want to do
                                      was to sort my entire document because that isn't the object I am
                                      working on.

                                      can you cut the piece to a new document, process it there then cut the
                                      finished work back to Doc Prev? That approach worked for my site
                                      indexing clip.

                                      --


                                      Jeffery G. Scism, IBSSG
                                      Flockmaster,
                                      International Blacksheep Society of Genealogists

                                      http://ibssg.org/blacksheep/

                                      http://bsmeadow.blogspot.com/ Blacksheep's Meadow

                                      http://www.flickr.com/photos/7764576@N05/ Photostream
                                    • Don - HtmlFixIt.com
                                      Hi Jeff, I certainly could, but then I have to keep track of what document I am coming from and then get it back. What we have concluded is that I don t need
                                      Message 18 of 25 , Jul 1 7:07 AM
                                      • 0 Attachment
                                        Hi Jeff,

                                        I certainly could, but then I have to keep track of what document I am
                                        coming from and then get it back. What we have concluded is that I
                                        don't need to do that. I can work directly on a variable (with ^P as
                                        separators) or on the clipboard also and that way I need not leave my
                                        document at all.

                                        I was doing exactly what you are suggesting which is to sort them and
                                        then put them back into the array variable.

                                        I understand it much better (I think anyway) than I did yesterday. We
                                        can probably try to help you with your clip if you post up the relevant
                                        parts (or all) and we can probably help you along.

                                        Don

                                        Jeff wrote:
                                        >
                                        > Don - HtmlFixIt.com wrote:
                                        > What I didn't want to do
                                        > was to sort my entire document because that isn't the object I am
                                        > working on.
                                        >
                                        > can you cut the piece to a new document, process it there then cut the
                                        > finished work back to Doc Prev? That approach worked for my site
                                        > indexing clip.
                                        >
                                      • Jeff
                                        OK here it is again. The original concept is to highlight a name ( Jeffery G. Scism ) in a document, have the Clip change it to scism-jeffery-g.htm on the
                                        Message 19 of 25 , Jul 1 7:18 AM
                                        • 0 Attachment
                                          OK here it is again.

                                          The original concept is to highlight a name ("Jeffery G. Scism") in a
                                          document, have the Clip change it to "scism-jeffery-g.htm" on the
                                          clipboard, so I can autosave the document using that as the file name. I
                                          don't want to change the name ON te source document, but only the name
                                          it is saved as. I want it to error out if the Doc already exists. I
                                          don't want to overwrite existing files. If a file already exists I need
                                          to merge the new entry, probably manually.

                                          I had clips that did the name swap in my old computer, but they ere
                                          lost in a HD Crash.

                                          I searched the Clips list archive and found some of the previous
                                          discussion but with what I am starting with I am getting "syntax
                                          errors" probably due to the improved Reg-ex now in use. It was
                                          originally written for NoteTab Std 4.95.

                                          Here is the broken clip I have been working on- it goes NOWHERE. (I
                                          just can't grasp the concepts apparently).


                                          __CLIP__

                                          :PARSE_NAME

                                          ^!Set %Folder%=^%Drop%
                                          ^!Toolbar Copy
                                          ^!SetListDelimiter " "
                                          ^!SetArray %full_name%=^$GetSelection$
                                          ^!Set %indexed_name%="^%full_name^%full_name0%%"
                                          ^!Set %name_counter%=1

                                          :CreateName
                                          ^!If ^%name_counter% = ^%full_name0% NameDone
                                          ^!Set %indexed_name%="^%indexed_name%-^%full_name^%name_counter%%"
                                          ^!Inc %name_counter%
                                          ^!Goto CreateName

                                          :NameDone
                                          ;strip periods
                                          ^!Set %indexed_name%=^$StrReplace(".";"";"^%indexed_name%";0;0)

                                          ^!Set %indexed_name%=^$StrLower("^%indexed_name%")$
                                          ;(Syntax error this line)
                                          ^!Set %indexed_name%=^$FileName$.htm

                                          __/CLIP__/
                                          /

                                          Don - HtmlFixIt.com wrote:
                                          >
                                          >
                                          > Hi Jeff,
                                          >
                                          > I certainly could, but then I have to keep track of what document I am
                                          > coming from and then get it back. What we have concluded is that I
                                          > don't need to do that. I can work directly on a variable (with ^P as
                                          > separators) or on the clipboard also and that way I need not leave my
                                          > document at all.
                                          >
                                          > I was doing exactly what you are suggesting which is to sort them and
                                          > then put them back into the array variable.
                                          >
                                          > I understand it much better (I think anyway) than I did yesterday. We
                                          > can probably try to help you with your clip if you post up the relevant
                                          > parts (or all) and we can probably help you along.
                                          >
                                          > Don
                                          >
                                          > Jeff wrote:
                                          > >
                                          > > Don - HtmlFixIt.com wrote:
                                          > > What I didn't want to do
                                          > > was to sort my entire document because that isn't the object I am
                                          > > working on.
                                          > >
                                          > > can you cut the piece to a new document, process it there then cut the
                                          > > finished work back to Doc Prev? That approach worked for my site
                                          > > indexing clip.
                                          > >
                                          >
                                          >
                                          > ------------------------------------------------------------------------
                                          >
                                          >
                                          > No virus found in this incoming message.
                                          > Checked by AVG - www.avg.com
                                          > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00
                                          >
                                          >

                                          --


                                          Jeffery G. Scism, IBSSG
                                          Flockmaster,
                                          International Blacksheep Society of Genealogists

                                          http://ibssg.org/blacksheep/

                                          http://bsmeadow.blogspot.com/ Blacksheep's Meadow

                                          http://www.flickr.com/photos/7764576@N05/ Photostream
                                        • Don - HtmlFixIt.com
                                          Okay, first let s start a different thread if you don t mind. Let s start by simpling this down and then building it back up, is that reasonable? How about
                                          Message 20 of 25 , Jul 1 7:36 AM
                                          • 0 Attachment
                                            Okay, first let's start a different thread if you don't mind.

                                            Let's start by simpling this down and then building it back up, is that
                                            reasonable?

                                            How about this:
                                            1. start with the file already open that we want to work on
                                            2. highlight the name
                                            3. save the file if doesn't exist already (are we renaming a file?)
                                            4. give an alert if file already exists

                                            Is that a good starting point?

                                            Also what possible parameters are there for the name?
                                            First I. Last
                                            First Last
                                            First Last-LastMore
                                            First I. Last, Suffix(Jr/Sr/II/III/etc.)

                                            For now I'll work on the first of those, but thought should be given to
                                            other variations.

                                            Don

                                            Jeff wrote:
                                            > OK here it is again.
                                            >
                                            > The original concept is to highlight a name ("Jeffery G. Scism") in a
                                            > document, have the Clip change it to "scism-jeffery-g.htm" on the
                                            > clipboard, so I can autosave the document using that as the file name. I
                                            > don't want to change the name ON te source document, but only the name
                                            > it is saved as. I want it to error out if the Doc already exists. I
                                            > don't want to overwrite existing files. If a file already exists I need
                                            > to merge the new entry, probably manually.
                                            >
                                            > I had clips that did the name swap in my old computer, but they ere
                                            > lost in a HD Crash.
                                            >
                                            > I searched the Clips list archive and found some of the previous
                                            > discussion but with what I am starting with I am getting "syntax
                                            > errors" probably due to the improved Reg-ex now in use. It was
                                            > originally written for NoteTab Std 4.95.
                                            >
                                            > Here is the broken clip I have been working on- it goes NOWHERE. (I
                                            > just can't grasp the concepts apparently).
                                            >
                                            >
                                            > __CLIP__
                                            >
                                            > :PARSE_NAME
                                            >
                                            > ^!Set %Folder%=^%Drop%
                                            > ^!Toolbar Copy
                                            > ^!SetListDelimiter " "
                                            > ^!SetArray %full_name%=^$GetSelection$
                                            > ^!Set %indexed_name%="^%full_name^%full_name0%%"
                                            > ^!Set %name_counter%=1
                                            >
                                            > :CreateName
                                            > ^!If ^%name_counter% = ^%full_name0% NameDone
                                            > ^!Set %indexed_name%="^%indexed_name%-^%full_name^%name_counter%%"
                                            > ^!Inc %name_counter%
                                            > ^!Goto CreateName
                                            >
                                            > :NameDone
                                            > ;strip periods
                                            > ^!Set %indexed_name%=^$StrReplace(".";"";"^%indexed_name%";0;0)
                                            >
                                            > ^!Set %indexed_name%=^$StrLower("^%indexed_name%")$
                                            > ;(Syntax error this line)
                                            > ^!Set %indexed_name%=^$FileName$.htm
                                            >
                                            > __/CLIP__/
                                            > /
                                          • Jeff
                                            Generally the files are new files not previously saved. Yes, at some cases there is a suffix to the name, like Sr., Jr. I, II, III, etc. Your starting point
                                            Message 21 of 25 , Jul 1 7:43 AM
                                            • 0 Attachment
                                              Generally the files are new files not previously saved.

                                              Yes, at some cases there is a suffix to the name, like Sr., Jr. I, II,
                                              III, etc.

                                              Your starting point is exactly right.

                                              (my transcribers are much faster than I am in coding the pages, this
                                              would save me enormous amounts of time. I really appreciate it.)

                                              Jeff

                                              Don - HtmlFixIt.com wrote:
                                              >
                                              >
                                              > Okay, first let's start a different thread if you don't mind.
                                              >
                                              > Let's start by simpling this down and then building it back up, is that
                                              > reasonable?
                                              >
                                              > How about this:
                                              > 1. start with the file already open that we want to work on
                                              > 2. highlight the name
                                              > 3. save the file if doesn't exist already (are we renaming a file?)
                                              > 4. give an alert if file already exists
                                              >
                                              > Is that a good starting point?
                                              >


                                              >
                                              > Also what possible parameters are there for the name?
                                              > First I. Last
                                              > First Last
                                              > First Last-LastMore
                                              > First I. Last, Suffix(Jr/Sr/II/III/etc.)
                                              >
                                              > For now I'll work on the first of those, but thought should be given to
                                              > other variations.
                                              >
                                              > Don
                                              >
                                              > Jeff wrote:
                                              > > OK here it is again.
                                              > >
                                              > > The original concept is to highlight a name ("Jeffery G. Scism") in a
                                              > > document, have the Clip change it to "scism-jeffery-g.htm" on the
                                              > > clipboard, so I can autosave the document using that as the file
                                              > name. I
                                              > > don't want to change the name ON te source document, but only the name
                                              > > it is saved as. I want it to error out if the Doc already exists. I
                                              > > don't want to overwrite existing files. If a file already exists I need
                                              > > to merge the new entry, probably manually.
                                              > >
                                              > > I had clips that did the name swap in my old computer, but they ere
                                              > > lost in a HD Crash.
                                              > >
                                              > > I searched the Clips list archive and found some of the previous
                                              > > discussion but with what I am starting with I am getting "syntax
                                              > > errors" probably due to the improved Reg-ex now in use. It was
                                              > > originally written for NoteTab Std 4.95.
                                              > >
                                              > > Here is the broken clip I have been working on- it goes NOWHERE. (I
                                              > > just can't grasp the concepts apparently).
                                              > >
                                              > >
                                              > > __CLIP__
                                              > >
                                              > > :PARSE_NAME
                                              > >
                                              > > ^!Set %Folder%=^%Drop%
                                              > > ^!Toolbar Copy
                                              > > ^!SetListDelimiter " "
                                              > > ^!SetArray %full_name%=^$GetSelection$
                                              > > ^!Set %indexed_name%="^%full_name^%full_name0%%"
                                              > > ^!Set %name_counter%=1
                                              > >
                                              > > :CreateName
                                              > > ^!If ^%name_counter% = ^%full_name0% NameDone
                                              > > ^!Set %indexed_name%="^%indexed_name%-^%full_name^%name_counter%%"
                                              > > ^!Inc %name_counter%
                                              > > ^!Goto CreateName
                                              > >
                                              > > :NameDone
                                              > > ;strip periods
                                              > > ^!Set %indexed_name%=^$StrReplace(".";"";"^%indexed_name%";0;0)
                                              > >
                                              > > ^!Set %indexed_name%=^$StrLower("^%indexed_name%")$
                                              > > ;(Syntax error this line)
                                              > > ^!Set %indexed_name%=^$FileName$.htm
                                              > >
                                              > > __/CLIP__/
                                              > > /
                                              >
                                              >
                                              > ------------------------------------------------------------------------
                                              >
                                              >
                                              > No virus found in this incoming message.
                                              > Checked by AVG - www.avg.com
                                              > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00
                                              >
                                              >

                                              --


                                              Jeffery G. Scism, IBSSG
                                              Flockmaster,
                                              International Blacksheep Society of Genealogists

                                              http://ibssg.org/blacksheep/

                                              http://bsmeadow.blogspot.com/ Blacksheep's Meadow

                                              http://www.flickr.com/photos/7764576@N05/ Photostream
                                            • Jeff Scism
                                              ... By the way save directory will be the one set by NoteTab in the Options box. Thanks.
                                              Message 22 of 25 , Jul 1 8:01 AM
                                              • 0 Attachment
                                                --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                                                >
                                                > Okay, first let's start a different thread if you don't mind.
                                                >
                                                > Let's start by simpling this down and then building it back up, is that
                                                > reasonable?
                                                >
                                                > How about this:
                                                > 1. start with the file already open that we want to work on
                                                > 2. highlight the name
                                                > 3. save the file if doesn't exist already (are we renaming a file?)
                                                > 4. give an alert if file already exists
                                                >

                                                By the way save directory will be the one set by NoteTab in the Options box.

                                                Thanks.
                                              • Don - HtmlFixIt.com
                                                Well my regex needs work ... it botches Jeff Schism, but works correctly on Jeff G. Schism ... I am trying to cover both situations -- and we should add in the
                                                Message 23 of 25 , Jul 1 8:03 AM
                                                • 0 Attachment
                                                  Well my regex needs work ... it botches Jeff Schism, but works correctly
                                                  on Jeff G. Schism ...
                                                  I am trying to cover both situations -- and we should add in the
                                                  suffixes too I suspect.

                                                  So file names will be:
                                                  Jeff Schism = schism-jeff--.html
                                                  Jeff G. Schism = schism-jeff-g-.html
                                                  Jeff G. Schism Jr. = schism-jeff-g-jr.html

                                                  or not?

                                                  ^!Continue [C]highlight name and hit control + c

                                                  ;set clipboard to empty
                                                  ^!SetClipboard

                                                  :LoopName
                                                  ;sit her and wait for something to be copied to clipboard
                                                  ^!Delay 5
                                                  ;if nothing on clipboard wait 5 more
                                                  ^!If "^$GetClipboardSize$" = "0" LoopName

                                                  :CheckName
                                                  ;make sure name is First I. Last or First Last
                                                  ^!Find "([A-Za-z]+) ([A-Za-z]*)\.{0,1} {0,1}([A-Za-z]+)" TIHRS
                                                  ^!IfError CheckNameError ELSE ProcessNametoFileName

                                                  :CheckNameError
                                                  ^!Info [C]We expect name to be First I. Last -- bad formatting for
                                                  name^PThis name is -^$GetClipboard$-^Pplease fix and retry
                                                  ^!Goto End


                                                  :ProcessNametoFileName
                                                  ^!SetArray %Array%=^$GetReSubStrings$
                                                  ^!Info [C]^%Array%
                                                  ^!Set %Name%="^$StrLower("^%Array3%-^%Array1%-^%Array2%")$"
                                                  ^!Info [C]Proposed file name:^%Name%.html

                                                  Jeff wrote:
                                                  > Generally the files are new files not previously saved.
                                                  >
                                                  > Yes, at some cases there is a suffix to the name, like Sr., Jr. I, II,
                                                  > III, etc.
                                                  >
                                                  > Your starting point is exactly right.
                                                  >
                                                  > (my transcribers are much faster than I am in coding the pages, this
                                                  > would save me enormous amounts of time. I really appreciate it.)
                                                  >
                                                  > Jeff
                                                  >
                                                  > Don - HtmlFixIt.com wrote:
                                                  >>
                                                  >> Okay, first let's start a different thread if you don't mind.
                                                  >>
                                                  >> Let's start by simpling this down and then building it back up, is that
                                                  >> reasonable?
                                                  >>
                                                  >> How about this:
                                                  >> 1. start with the file already open that we want to work on
                                                  >> 2. highlight the name
                                                  >> 3. save the file if doesn't exist already (are we renaming a file?)
                                                  >> 4. give an alert if file already exists
                                                  >>
                                                  >> Is that a good starting point?
                                                  >>
                                                  >
                                                  >
                                                  >> Also what possible parameters are there for the name?
                                                  >> First I. Last
                                                  >> First Last
                                                  >> First Last-LastMore
                                                  >> First I. Last, Suffix(Jr/Sr/II/III/etc.)
                                                  >>
                                                  >> For now I'll work on the first of those, but thought should be given to
                                                  >> other variations.
                                                  >>
                                                  >> Don
                                                  >>
                                                  >> Jeff wrote:
                                                  >>> OK here it is again.
                                                  >>>
                                                  >>> The original concept is to highlight a name ("Jeffery G. Scism") in a
                                                  >>> document, have the Clip change it to "scism-jeffery-g.htm" on the
                                                  >>> clipboard, so I can autosave the document using that as the file
                                                  >> name. I
                                                  >>> don't want to change the name ON te source document, but only the name
                                                  >>> it is saved as. I want it to error out if the Doc already exists. I
                                                  >>> don't want to overwrite existing files. If a file already exists I need
                                                  >>> to merge the new entry, probably manually.
                                                  >>>
                                                  >>> I had clips that did the name swap in my old computer, but they ere
                                                  >>> lost in a HD Crash.
                                                  >>>
                                                  >>> I searched the Clips list archive and found some of the previous
                                                  >>> discussion but with what I am starting with I am getting "syntax
                                                  >>> errors" probably due to the improved Reg-ex now in use. It was
                                                  >>> originally written for NoteTab Std 4.95.
                                                  >>>
                                                  >>> Here is the broken clip I have been working on- it goes NOWHERE. (I
                                                  >>> just can't grasp the concepts apparently).
                                                  >>>
                                                  >>>
                                                  >>> __CLIP__
                                                  >>>
                                                  >>> :PARSE_NAME
                                                  >>>
                                                  >>> ^!Set %Folder%=^%Drop%
                                                  >>> ^!Toolbar Copy
                                                  >>> ^!SetListDelimiter " "
                                                  >>> ^!SetArray %full_name%=^$GetSelection$
                                                  >>> ^!Set %indexed_name%="^%full_name^%full_name0%%"
                                                  >>> ^!Set %name_counter%=1
                                                  >>>
                                                  >>> :CreateName
                                                  >>> ^!If ^%name_counter% = ^%full_name0% NameDone
                                                  >>> ^!Set %indexed_name%="^%indexed_name%-^%full_name^%name_counter%%"
                                                  >>> ^!Inc %name_counter%
                                                  >>> ^!Goto CreateName
                                                  >>>
                                                  >>> :NameDone
                                                  >>> ;strip periods
                                                  >>> ^!Set %indexed_name%=^$StrReplace(".";"";"^%indexed_name%";0;0)
                                                  >>>
                                                  >>> ^!Set %indexed_name%=^$StrLower("^%indexed_name%")$
                                                  >>> ;(Syntax error this line)
                                                  >>> ^!Set %indexed_name%=^$FileName$.htm
                                                  >>>
                                                  >>> __/CLIP__/
                                                  >>> /
                                                  >>
                                                  >> ------------------------------------------------------------------------
                                                  >>
                                                  >>
                                                  >> No virus found in this incoming message.
                                                  >> Checked by AVG - www.avg.com
                                                  >> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00
                                                  >>
                                                  >>
                                                  >
                                                • Don - HtmlFixIt.com
                                                  yeah well lets get it doing the right things with the name first ... progress ... ^!Continue [C]highlight name and hit control + c ;set clipboard to empty
                                                  Message 24 of 25 , Jul 1 8:14 AM
                                                  • 0 Attachment
                                                    yeah well lets get it doing the right things with the name first ...
                                                    progress ...
                                                    ^!Continue [C]highlight name and hit control + c

                                                    ;set clipboard to empty
                                                    ^!SetClipboard

                                                    :LoopName
                                                    ;sit her and wait for something to be copied to clipboard
                                                    ^!Delay 5
                                                    ;if nothing on clipboard wait 5 more
                                                    ^!If "^$GetClipboardSize$" = "0" LoopName

                                                    :CheckName
                                                    ;make sure name is First I. Last or First Last
                                                    ^!Find "([A-Za-z]+) ([A-Za-z])\. ([A-Za-z]+)" TIHRS
                                                    ^!IfError Next ELSE ProcessNametoFileName
                                                    ^!Find "([A-Za-z]+) ([A-Za-z]+)" TIHRS
                                                    ^!IfError CheckNameError ELSE ProcessNametoFileName

                                                    :CheckNameError
                                                    ^!Info [C]We expect name to be First I. Last or First Last^Pbad
                                                    formatting for name^PThis name is -^$GetClipboard$-^Pplease fix and retry
                                                    ^!Goto End


                                                    :ProcessNametoFileName
                                                    ^!SetArray %NameArray%=^$GetReSubStrings$
                                                    ^!Info [C]^%NameArray%
                                                    ^!If "^%NameArray0%" = "2" NoMiddle ELSE Middle
                                                    :Middle
                                                    ^!Set %Name%="^$StrLower("^%NameArray3%-^%NameArray1%-^%NameArray2%")$"
                                                    ^!Goto NameOutput
                                                    :NoMiddle
                                                    ^!Set %Name%="^$StrLower("^%NameArray2%-^%NameArray1%-")$"
                                                    :NameOutput
                                                    ^!Info [C]Proposed file name:^%Name%.html



                                                    Jeff Scism wrote:
                                                    > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                                                    >> Okay, first let's start a different thread if you don't mind.
                                                    >>
                                                    >> Let's start by simpling this down and then building it back up, is that
                                                    >> reasonable?
                                                    >>
                                                    >> How about this:
                                                    >> 1. start with the file already open that we want to work on
                                                    >> 2. highlight the name
                                                    >> 3. save the file if doesn't exist already (are we renaming a file?)
                                                    >> 4. give an alert if file already exists
                                                    >>
                                                    >
                                                    > By the way save directory will be the one set by NoteTab in the Options box.
                                                    >
                                                    > Thanks.
                                                    >
                                                    >
                                                    >
                                                    > ------------------------------------
                                                    >
                                                    > Fookes Software: http://www.fookes.com/
                                                    > NoteTab website: http://www.notetab.com/
                                                    > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                                                    >
                                                    > ***
                                                    > Yahoo! Groups Links
                                                    >
                                                    >
                                                    >
                                                    >
                                                  • Don - HtmlFixIt.com
                                                    Your assistance was of much help Sheri and Alec! and the magic line that in fact sorts from a semi-colon delimited (that is the default) array back into the
                                                    Message 25 of 25 , Jul 1 1:52 PM
                                                    • 0 Attachment
                                                      Your assistance was of much help Sheri and Alec!

                                                      and the magic line that in fact sorts from a semi-colon delimited (that
                                                      is the default) array back into the same semi-colon delimited array ....
                                                      all one line ...

                                                      ^!SetArray
                                                      %fielddynamics%=^$StrReplace("^P";";";"^$StrSort("^$StrReplace(";";"^P";"^%fielddynamics%";0;0)$";No;Yes;No)$";No;No)$

                                                      so I had this in fielddynamics when I started:
                                                      0031:2:33:Place;0005:26:31:Name;0034:22:56:School;0001:3:4:Grade;0056:8:64:Time

                                                      And this when I'm done:
                                                      0001:3:4:Grade;0005:26:31:Name;0031:2:33:Place;0034:22:56:School;0056:8:64:Time

                                                      So it is sorted 1, 5, 31, 34, 56 as it should be.

                                                      Alec Burgess wrote:
                                                      > Don ... our messages crossed each other. You are saying much the same as
                                                      > I did below "-)
                                                      >
                                                      > Don - HtmlFixIt.com (don@...) wrote (in part) (on 2009-07-01
                                                      > at 00:30):
                                                      > ^!SetClipboard=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                                                      >> ^!SetArray
                                                      > ew%=^$StrReplace("^P";";";"^$GetClipboard$";0;0)$
                                                      >> ^!Info [C]^
                                                      > ew%
                                                      >> 03;05;12;15;24;50;54;99
                                                      >>
                                                      >> If I were willing to use ^P as delimiters think I can get it down to
                                                      >> one
                                                      >> line.
                                                      >>
                                                      >> ^!SetArray
                                                      >>
                                                      > ew%=^$StrSort("^$StrReplace(";";"^P";"12;03;15;99;24;05;54;50";0;0)$";No;Yes;No)$
                                                      >
                                                    Your message has been successfully submitted and would be delivered to recipients shortly.