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

Re: [Clip] Newbie, can anyone help please ?

Expand Messages
  • buralex@gmail.com
    petermarchal12 said on Apr 15, 2008 19:21 ... Peter: See clip below Anyone: how do I avoid requiring the [Enter] on the Number
    Message 1 of 12 , Apr 15, 2008
    • 0 Attachment
      "petermarchal12" <konijntjepluis@...> said on Apr 15, 2008 19:21
      -0400 (in part):
      > 2) After that I need to change the first number in the
      > "$LOG(number,number)" part, so that they become in order again. So
      > giving the ending result of my script like this :
      > ------------------------------
      > Some text here
      > another line of text
      > and another one, the amount of text lines here can change
      > [Important] $LOG(1,6)$SET(value=1359)
      > [Important] $LOG(2,6)$SET(value=3711)
      > [Important] $LOG(3,6)$SET(value=5883)
      > [Important] $LOG(4,6)$SET(value=1864)
      > [Important] $LOG(5,6)$SET(value=2218)
      > [Important] $LOG(6,6)$SET(value=5130)
      > Some text here
      > another line of text
      > and another one, the amount of text lines here can change
      > ------------------------------
      Peter: See clip below
      Anyone: how do I avoid requiring the [Enter] on the Number Lines dialog
      (other than line numbering myself in a loop or using the Perl-Number
      lines in Sample clips)

      RandomizeLines-PeterM
      ;Alec Burgess v1.0.0 2008/04/15
      ; 1) Identify lines starting with [Important]
      ; eg. [Important] $LOG(1,6)$SET( value=3711)
      ; $LOG(5,6)$SET( value=1864)
      ; 2) Randomize them
      ; 3) make number within LOG(n,6) be sequential (from 1)
      ; Note - I've left an "^!Info" box enabled for visual inspection. remove
      when sure its working
      ; Note - you have to click the Number Lines [OK]
      ; - I haven't figured out how to avoid this ???

      ^!select 0
      ^!setlistdelimiter ^P

      ;Find the target lines
      ^!set %thePattern%="(?-s)\[Important\].*"
      ^!setarray %theLines%=^$GetDocMatchAll("^%thePattern%")$

      ;loop over array and insert random number before each format
      =num=remainder of line
      ^!set %i%=0
      :loop
      ^!inc i
      ^!if ^%i%>^%theLines0% :loop_done
      ^!set %theLines^%i%%==^$StrRandom(4;0123456789)$=^%theLines^%i%%
      ^!goto :loop
      :loop_done

      ; sort theLines ^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$
      ^!set %sortLines%=^$StrSort(^%theLines%;0;1;0)$
      ^!info ^%sortLines%

      ;select from first target line to last and replace
      ^!find "(?s)^(\[Important\]).*\1.*?\r\n" rwsai
      ^!inserttext ^%sortLines%^P

      ;re-select target lines and number
      ^!find "(?s)^=\d+=(\[Important\]).*\1.*?\r\n" rwsai
      ; need to hit enter to accept numbering by 1
      ^!menu modify/lines/"number lines"

      ;grab number, remove "=randomnum=", replace in "(num"
      ^!replace "(\d+)(\.\s=\d+=)(.*?LOG\()\d+" >> "$3$1" rwais


      Regards ... Alec -- buralex-gmail
      --



      [Non-text portions of this message have been removed]
    • buralex@gmail.com
      @Peter: I tried to send this yesterday but somehow it never made it to the list @Flo: I tried yours but was getting a NOT FOUND on line 3: * ^!Find
      Message 2 of 12 , Apr 16, 2008
      • 0 Attachment
        @Peter: I tried to send this yesterday but somehow it never made it to
        the list
        @Flo: I tried yours but was getting a NOT FOUND on line 3:

        * ^!Find "(?s)\[Important. +\d{4}\)" R

        is the space accidental or a yahoo-groups error:

        * ^!Find "(?s)\[Important.==space== +\d{4}\)" R

        after correcting that it still didn't work quite right though by visual
        inspection the logic looks good. Peter didn't say whether the number of
        matching lines is always 6 - I don't know how long it would take if it
        were 1000's?

        buralex@... said on Apr 15, 2008 22:51 -0400 (in part):

        "petermarchal12" <konijntjepluis@...> said on Apr 15, 2008 19:21
        -0400 (in part):
        > 2) After that I need to change the first number in the
        > "$LOG(number,number)" part, so that they become in order again. So
        > giving the ending result of my script like this :
        > ------------------------------
        > Some text here
        > another line of text
        > and another one, the amount of text lines here can change
        > [Important] $LOG(1,6)$SET(value=1359)
        > [Important] $LOG(2,6)$SET(value=3711)
        > [Important] $LOG(3,6)$SET(value=5883)
        > [Important] $LOG(4,6)$SET(value=1864)
        > [Important] $LOG(5,6)$SET(value=2218)
        > [Important] $LOG(6,6)$SET(value=5130)
        > Some text here
        > another line of text
        > and another one, the amount of text lines here can change
        > ------------------------------
        Peter: See clip below
        Anyone: how do I avoid requiring the [Enter] on the Number Lines dialog
        (other than line numbering myself in a loop or using the Perl-Number
        lines in Sample clips)

        RandomizeLines-PeterM
        ;Alec Burgess v1.0.0 2008/04/15
        ; 1) Identify lines starting with [Important]
        ; eg. [Important] $LOG(1,6)$SET( value=3711)
        ; $LOG(5,6)$SET( value=1864)
        ; 2) Randomize them
        ; 3) make number within LOG(n,6) be sequential (from 1)
        ; Note - I've left an "^!Info" box enabled for visual inspection. remove
        when sure its working
        ; Note - you have to click the Number Lines [OK]
        ; - I haven't figured out how to avoid this ???

        ^!select 0
        ^!setlistdelimiter ^P

        ;Find the target lines
        ^!set %thePattern%="(?-s)\[Important\].*"
        ^!setarray %theLines%=^$GetDocMatchAll("^%thePattern%")$

        ;loop over array and insert random number before each format
        =num=remainder of line
        ^!set %i%=0
        :loop
        ^!inc i
        ^!if ^%i%>^%theLines0% :loop_done
        ^!set %theLines^%i%%==^$StrRandom(4;0123456789)$=^%theLines^%i%%
        ^!goto :loop
        :loop_done

        ; sort theLines ^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$
        ^!set %sortLines%=^$StrSort(^%theLines%;0;1;0)$
        ^!info ^%sortLines%

        ;select from first target line to last and replace
        ^!find "(?s)^(\[Important\]).*\1.*?\r\n" rwsai
        ^!inserttext ^%sortLines%^P

        ;re-select target lines and number
        ^!find "(?s)^=\d+=(\[Important\]).*\1.*?\r\n" rwsai
        ; need to hit enter to accept numbering by 1
        ^!menu modify/lines/"number lines"

        ;grab number, remove "=randomnum=", replace in "(num"
        ^!replace "(\d+)(\.\s=\d+=)(.*?LOG\()\d+" >> "$3$1" rwais


        Regards ... Alec -- buralex-gmail
        --



        [Non-text portions of this message have been removed]
      • buralex@gmail.com
        petermarchal12 said on Apr 16, 2008 23:46 ... sort of :-! As currently coded it ignores *anything* in front of [Important] at
        Message 3 of 12 , Apr 16, 2008
        • 0 Attachment
          "petermarchal12" <konijntjepluis@...> said on Apr 16, 2008 23:46
          -0400 (in part):
          > Thanks Alec ! Seems to work !!
          >
          > Just one tiny question, is it possible that this clip does not take
          > lines starting with # into account ?
          > So only processing these lines when they DO NOT start with # ?
          sort of :-!
          As currently coded it ignores *anything* in front of "[Important]" at
          the beginning of a line.
          ie. "xx error xx[Important] $LOG(4,6)$SET( value=5130)" would just wind
          up removing "xx error xx" as if it weren't there and generate the same 6
          lines randomized.

          Its possible to rework the algorithm so that it will handle this
          differently though currently it expects all the targeted lines to be in
          a group and simply replaces the whole mess with the lines:

          * ;select from first target line to last and replace
          * ^!find "(?s)^(\[Important\]).*\1.*?\r\n" rwsai
          o this line selects all the way from the first line beginning
          with [Important]
          o to the end of the last line in the file starting with
          [Important] and
          + eats anything in between that doesn't match.
          * ^!inserttext ^%sortLines%^P

          Since we've got this far, could you post a sample of your ACTUAL data
          (or save a file in yahoo-groups files
          http://tech.groups.yahoo.com/group/ntb-clips/files/Help_wanted/ ) and
          indicate what the problem is with what you are getting currently.

          (my 17732 TEST only message appeared on yahoo-group list in
          seconds so hopefully dropped messages problem was a one-time occurrence)

          Regards ... Alec -- buralex-gmail
          --



          [Non-text portions of this message have been removed]
        • Flo
          ... Alec, Sorry, but I don t have any explanation for that. I ve tested my clip several times and I ve never got that message. Also, in my copy of the Yahoo
          Message 4 of 12 , Apr 17, 2008
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "Alec Burgess" <buralex@...> wrote:

            > @Flo: I tried yours but was getting a NOT FOUND on line 3:
            >
            > * ^!Find "(?s)\[Important. +\d{4}\)" R
            >
            > is the space accidental or a yahoo-groups error:
            >
            > * ^!Find "(?s)\[Important.==space== +\d{4}\)" R
            >
            > after correcting that it still didn't work quite right though
            > by visual inspection the logic looks good.

            Alec,

            Sorry, but I don't have any explanation for that. I've tested my clip
            several times and I've never got that message.

            Also, in my copy of the Yahoo e-mail, there is no space at that
            position...

            ^!Find "(?s)\[Important.==space== +\d{4}\)" R

            Could there be a difference in the text we are using for testing? I
            took the first example in Peter's post, that is...

            --- Test text start
            Some text here
            another line of text
            and another one, the amount of text lines here can change
            [Important] $LOG(1,6)$SET(value=3711)
            [Important] $LOG(2,6)$SET(value=2218)
            [Important] $LOG(3,6)$SET(value=5883)
            [Important] $LOG(4,6)$SET(value=5130)
            [Important] $LOG(5,6)$SET(value=1864)
            [Important] $LOG(6,6)$SET(value=1359)
            Some text here
            another line of text
            and another one, the amount of text lines here can change
            --- Test text end

            I wonder if anyone encounters that message...

            Flo
             
          • Flo
            ... Alec, Correction of last line: I wonder if anyone ELSE (but Alec) encounters that message - of course ;-) By the way: I ve been surprised that we didn t
            Message 5 of 12 , Apr 17, 2008
            • 0 Attachment
              ***Revised version***

              --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:
              >
              > I wonder if anyone encounters that message...

              Alec,

              Correction of last line: "I wonder if anyone ELSE (but Alec) encounters
              that message" - of course ;-)

              By the way: I've been surprised that we didn't get an announcement of
              NoteTab v.5.61 (released 05 February 2008) in this forum - or did I
              fail to see it? I'm using tis update now -- maybe something has changed
              that could explain why you get this message?

              Flo
               
            • petermarchal12
              ... Hi Flo, I tested your script too, It seem to work quite right (doesn t give me any error) but it was also messing with some other lines (not starting with
              Message 6 of 12 , Apr 18, 2008
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:
                >
                > ***Revised version***
                >
                > --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@> wrote:
                > >
                > > I wonder if anyone encounters that message...
                >
                > Alec,
                >
                > Correction of last line: "I wonder if anyone ELSE (but Alec) encounters
                > that message" - of course ;-)
                >
                > By the way: I've been surprised that we didn't get an announcement of
                > NoteTab v.5.61 (released 05 February 2008) in this forum - or did I
                > fail to see it? I'm using tis update now -- maybe something has changed
                > that could explain why you get this message?
                >
                > Flo
                >
                >
                Hi Flo,

                I tested your script too,
                It seem to work quite right (doesn't give me any error) but it was also messing with some
                other lines (not starting with the string) resulting in the order of lines being mangled through each other.
              • petermarchal12
                ... Just to add, NONE of the clips posted did work. I m leaving this crap tool, and am now searching for a program that does work. Regards. P.S. A forum is
                Message 7 of 12 , Apr 18, 2008
                • 0 Attachment
                  --- In ntb-clips@yahoogroups.com, "petermarchal12" <konijntjepluis@...> wrote:
                  >
                  > Hi,
                  >
                  > I'm new to NoteTab Pro, and I need some help please.
                  > I tried so many times but I cannot get the clip to do what I want.
                  >
                  > I have this textfile looking like this :
                  > ------------------------------
                  > Some text here
                  > another line of text
                  > and another one, the amount of text lines here can change
                  > [Important] $LOG(1,6)$SET(value=3711)
                  > [Important] $LOG(2,6)$SET(value=2218)
                  > [Important] $LOG(3,6)$SET(value=5883)
                  > [Important] $LOG(4,6)$SET(value=5130)
                  > [Important] $LOG(5,6)$SET(value=1864)
                  > [Important] $LOG(6,6)$SET(value=1359)
                  > Some text here
                  > another line of text
                  > and another one, the amount of text lines here can change
                  > ------------------------------
                  >
                  > I want to do the following 2 things :
                  >
                  > 1) I need a script that will focus on the lines starting with
                  > [Important].
                  > These lines need to be randomly positioned, Ie, they need to start at
                  > the same line in the file where the first [Important] line is found, but
                  > they need to be in a random order there. For example, like this :
                  > ------------------------------
                  > Some text here
                  > another line of text
                  > and another one, the amount of text lines here can change
                  > [Important] $LOG(6,6)$SET(value=1359)
                  > [Important] $LOG(1,6)$SET(value=3711)
                  > [Important] $LOG(3,6)$SET(value=5883)
                  > [Important] $LOG(5,6)$SET(value=1864)
                  > [Important] $LOG(2,6)$SET(value=2218)
                  > [Important] $LOG(4,6)$SET(value=5130)
                  > Some text here
                  > another line of text
                  > and another one, the amount of text lines here can change
                  > ------------------------------
                  >
                  > 2) After that I need to change the first number in the
                  > "$LOG(number,number)" part, so that they become in order again. So
                  > giving the ending result of my script like this :
                  > ------------------------------
                  > Some text here
                  > another line of text
                  > and another one, the amount of text lines here can change
                  > [Important] $LOG(1,6)$SET(value=1359)
                  > [Important] $LOG(2,6)$SET(value=3711)
                  > [Important] $LOG(3,6)$SET(value=5883)
                  > [Important] $LOG(4,6)$SET(value=1864)
                  > [Important] $LOG(5,6)$SET(value=2218)
                  > [Important] $LOG(6,6)$SET(value=5130)
                  > Some text here
                  > another line of text
                  > and another one, the amount of text lines here can change
                  > ------------------------------
                  >
                  > Please can anyone tell me how to achieve this please ?
                  >
                  > Thanks !
                  >
                  Just to add, NONE of the clips posted did work.
                  I'm leaving this crap tool, and am now searching for a program that does work.

                  Regards.

                  P.S. A forum is quite expensive these day eh.
                • Don - HtmlFixIt.com
                  ... Lol, I couldn t understand what you even wanted. To come ask for help in a convoluted way and then insult one of the greatest tools I have ever used. Am
                  Message 8 of 12 , Apr 18, 2008
                  • 0 Attachment
                    petermarchal12 wrote:
                    > --- In ntb-clips@yahoogroups.com, "petermarchal12" <konijntjepluis@...> wrote:
                    >> Hi,
                    >>
                    >> I'm new to NoteTab Pro, and I need some help please.
                    >> I tried so many times but I cannot get the clip to do what I want.
                    >>
                    >> I have this textfile looking like this :
                    >> ------------------------------
                    >> Some text here
                    >> another line of text
                    >> and another one, the amount of text lines here can change
                    >> [Important] $LOG(1,6)$SET(value=3711)
                    >> [Important] $LOG(2,6)$SET(value=2218)
                    >> [Important] $LOG(3,6)$SET(value=5883)
                    >> [Important] $LOG(4,6)$SET(value=5130)
                    >> Thanks !
                    >>
                    > Just to add, NONE of the clips posted did work.
                    > I'm leaving this crap tool, and am now searching for a program that does work.
                    >
                    > Regards.
                    >
                    > P.S. A forum is quite expensive these day eh.
                    >

                    Lol, I couldn't understand what you even wanted. To come ask for help
                    in a convoluted way and then insult one of the greatest tools I have
                    ever used. Am I missing something? Don't blame us for your
                    shortcomings. Good luck finding what you want. Trust me this tool can
                    do it and do it well, but you won't get help from me. No idea what your
                    last comment means. It's as confusing as your original post.

                    Goodbye.
                  Your message has been successfully submitted and would be delivered to recipients shortly.