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

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

Expand Messages
  • buralex@gmail.com
    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)

      ;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
      ^!inc i
      ^!if ^%i%>^%theLines0% :loop_done
      ^!set %theLines^%i%%==^$StrRandom(4;0123456789)$=^%theLines^%i%%
      ^!goto :loop

      ; 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]
    • Show all 12 messages in this topic