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

Re: [Clip] Re: Twos and Threes

Expand Messages
  • Adrian Worsfold
    Hello Flo Many thanks but (for explanation) in a CD timing a .1 is more than the time with minutes and seconds only, so it always adds a second, never loses
    Message 1 of 10 , May 25, 2013
    • 0 Attachment
      Hello Flo

      Many thanks but (for explanation) in a CD timing a .1 is more than the time with minutes and seconds only, so it always adds a second, never loses time. I've taken that loss bit out and the rest works very well.

      If only I could work out how! I'm most grateful.

      Here is the complete clip I now use.

      ^!ClearVariables
      ^!Toolbar New Document
      ^!Set %Preacher%=^?[Click on the Service Taker's name=_Adrian Worsfold|Barry Cundill|Bernard McHugh|Chris Pilkington|David Arthur|Elizabeth Faiers|Ernest Baker|Jim Timiney|John Midgley|John Williams|June Pettitt|Keith Brown|Marion Baker|Mavis Lake|Michael Tracey|Rosemary Arthur|Stephanie Cage|Stephen Carlile]
      ^!Info [L]"Print the CD Cover to PDF and copy the tracks.^PAlso note the total time of tracks before the first hymn^P(wipe out first hymn onward - do not save!)."
      ^!ShellWait "C:\Program Files\CDBurnerXP\cdbxpp.exe"
      ^!SetScreenUpdate Off
      ^!InsertHTML ^P^P

      ^!Set %Date%=^$GetDateFromInt(^$Calc(CEIL((^$GetDateToInt$+6)/7)*7-6)$;yyyymmdd)$
      ^!Set %Filename%="Service ^%Date%"
      ^!Toolbar New Document
      ^!Set %Trackslist1%=^$Getclipboard$
      ^!InsertText ^%Trackslist1%
      ^!Jump Doc_Start
      ^!SetHintInfo Working...
      ^!SetScreenUpdate Off
      ; Remove spaces at start or end of lines
      ^!Replace "^\x20+|\x20+$" >> "" WARS
      ; Make new line break
      ^!Replace "\R(?![1-9])" >> "\x20" WARS
      ; Remove new space at EOF
      ^!Replace "\x20+\Z" >> "" WRS
      ^!Jump Doc_Start
      :Seconds
      ^!Find "(\d\d)\.\d$" RS
      ^!IfError Skip_2
      ^!InsertText "^$Calc(^$GetReSubstrings$+1)$"
      ^!Goto Seconds
      ^!Jump Doc_Start
      :Minutes_1
      ^!Find "([0][1-8]):60$" RS
      ^!IfError Skip_2
      ^!InsertText "0^$Calc(^$GetReSubStrings$+1)$:00"
      ^!Goto Minutes_1
      ^!Jump Doc_Start
      :Minutes_2
      ^!Find "([0][1-9]):60$" RS
      ^!IfError Skip_2
      ^!InsertText "^$Calc(^$GetReSubStrings$+1)$:00"
      ^!Goto Minutes_2
      ^!Jump Doc_Start
      :Minutes_3
      ^!Jump Doc_Start
      ^!Find "(\d\d):60$" RS
      ^!IfError Out
      ^!InsertText "^$Calc(^$GetReSubStrings$+1)$:00"
      ^!Goto Minutes_3
      :Out
      ^!Replace ":\K(?=\d$)" >> "0" WARS
      ; Embrace time with square brackets / Remove '00' hours
      ^!Replace "00:(\d\d:\d\d)$" >> "[$1]" WARS
      ^!Jump 1

      ^!Clip "Sorting numbers zeros"
      ^!Select All
      ^!Set %Trackslist2%=^$GetSelection$

      ^!DestroyDoc
      ^!FocusDoc
      ;Removes last lines if blank
      ^!Replace "\R{1,}\Z" >> "" WRS

      ^!Jump Doc_Start
      ^!Set %Minutes%=^?{Minutes Long (two digits)=20}
      ^!Set %Seconds%=^?{Seconds Long (two digits)=00}
      ^!Set %Minsclock%=^$Calc(60-^%Minutes%)$

      ^!InsertText "^P^PService ^%Date%^P^P^%Preacher%^P^P^P<Start 10:^%Minsclock% for 11:00 start [^%Minutes%:^%Seconds%]>^P^P"
      ^!InsertText ^%Trackslist2%
      ^!Save As "C:\Shared Documents\Music\^%Filename%.txt"

      The clip for adding zeros - "Sorting numbers zeros" - functions fully and is this:

      ^!SetHintInfo Working...
      ^!SetScreenUpdate Off
      ^!Set %dig%=2
      ^!Find "^\d{^%dig%}" WRS
      ^!IfError Skip_2
      ^!Inc %dig%
      ^!Goto Skip_-3
      ^!Dec %dig%
      ^!Set %q%=^$Calc(^%dig%-1)$
      ^!Replace "^" >> "^$StrFill(\x30;^%dig%)$" WARS
      ^!Replace "^\x30+?(.{^%q%}\d\b)" >> "$1" WARS
      ^!Select All
      ^$StrSort("^$GetSelection$";0;1;0)$

      So this is what happens. There are preset choices for preachers to select, timings for the service to begin (at the first hymn; the seconds don't count - it helps to start slightly late anyway), the document gets dated and saved for the Sunday's date, and the list is made neat, as derived from the CD cover printed to PDF from its raw 3 lines to track 9 and 2 lines to track 10 when examined as text.

      * There is one final potential clip that hardly saves on human viewing, but one may as well push it to the logical end.

      After the number, the presence of HL nnn, SF nnn, LS nn, CC nn, HW nnn, HF nnn, or NB nn indicates a hymn book (or latter no book still with numbers up to 99). Before each hymn book, and after it but not before another hymn book, there is a blank line inserted. This is to tell me to use a second CD made at a higher level of volume which people sing against. Now I am sure this is within my abilities, eventually, the complication being not wanting a blank line in between two hymns indicated by either leading code after the number.

      This final clip would produce (including the effect of the clips above):


      Service 20130526

      David Arthur

      <Start 10:40 for 11:00 start [20:33]>

      01 Prinknash Stanbrook Abbeys Monks Nuns Abbey Bells Introit [02:00]
      02 RudorffErnst KerseyJohn Impromptu op. 51 [03:52]
      03 FranckEduard KerseyJohn Klavierstuck op 62 no 6 [05:57]
      04 SmithSydney KerseyJohn Aspiration melodie op 208 no 1 [04:14]
      05 AshtonAlgernon KerseyJohn Toccata op 127 no 4 [02:17]
      06 WolfHugo RegerMax KerseyJohn Begegnung [02:03]

      07 HL 126 Stenka Razin choir [01:41]
      08 SF 064 Wentworth choir [01:38]

      09 ReussHeinrich KerseyJohn Andante in G minor [05:04]

      10 SF 060 This Old Man choir piano [01:51]

      11 KopylovAlexander KerseyJohn Feuille d'album in C [01:54]

      12 SF 030 Middleton choir [02:28]

      13 Rosenhain KerseyJohn Romance op 14 no 4 [03:01]
      14 ScholtzHerrmann KerseyJohn Albumblatt op 20 no 3 [02:54]
      15 RudorffErnst KerseyJohn Capriccio appassionato, op 48 [05:14]
      16 Birtwistle Triumph of Time [29:32]




      Adrian Worsfold

      http://www.pluralist.co.uk
      http://pluralistspeaks.blogspot.com
      pluralist@...
      25-05-2013
      ----- Received the following content -----
      From: flo.gehrke
      Receiver: ntb-clips
      Time: 2013-05-25, 14:50:10
      Subject: [Clip] Re: Twos and Threes


      [Non-text portions of this message have been removed]
    • flo.gehrke
      ... Adrian, I took the latest list and inserted some hymns at different positions in order to get all possible conditions... 0 CC Any Hymn A [10:30] 1
      Message 2 of 10 , May 26, 2013
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "Adrian Worsfold"<pluralist@...> wrote:
        >
        > After the number, the presence of HL nnn, SF nnn, LS nn,
        > CC nn, HW nnn, HF nnn, or NB nn indicates a hymn book (...).
        > Before each hymn book, and after it but not before another
        > hymn book, there is a blank line inserted. (...) the complication
        > being not wanting a blank line in between two hymns

        Adrian,

        I took the latest list and inserted some hymns at different positions in order to get all possible conditions...


        0 CC Any Hymn A [10:30]
        1 Prinknash Stanbrook Abbeys Monks Nuns Abbey Bells Introit [01:58]
        2 RudorffErnst KerseyJohn Impromptu op. 51 [12:59]
        3 FranckEduard KerseyJohn Klavierstuck op 62 no 6 [04:00]
        4 SmithSydney KerseyJohn Aspiration melodie op 208 no 1 [11:00]
        5 AshtonAlgernon KerseyJohn Toccata op 127 no 4 [16:00]
        6 WolfHugo RegerMax KerseyJohn Begegnung [02:03]
        7 HL 126 Stenka Razin choir [10:00]
        8 SF 064 Wentworth choir [10:09]
        9 ReussHeinrich KerseyJohn Andante in G minor [10:01]
        10 SF 060 This Old Man choir piano [12:10]
        11 KopylovAlexander KerseyJohn Feuille d'album in C [07:03]
        12 SF 030 Middleton choir [02:27]
        13 Rosenhain KerseyJohn Romance op 14 no 4 [01:37]
        14 ScholtzHerrmann KerseyJohn Albumblatt op 20 no 3 [12:59]
        XX LS Any hymn B [05:12]
        XX HF Any hymn C [11:10]
        XX HW Any hymn D [04:20]
        15 RudorffErnst KerseyJohn Capriccio appassionato, op 48 [05:14]
        16 Birtwistle Triumph of Time [29:32]
        XX LS Any hymn E [07:12]


        Now try the following clip against that list:


        ^!Replace "^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*$" >> "\r\n$0\r\n" WARS
        ^!Replace "\R{3}" >> "\r\n" WARS
        ^!Replace "^\A\R|\R{1,}\Z" >> "" WARS


        For me, the result is...

        0 CC Any Hymn [10:30]

        1 Prinknash Stanbrook Abbeys Monks Nuns Abbey Bells Introit [01:58]
        2 RudorffErnst KerseyJohn Impromptu op. 51 [12:59]
        3 FranckEduard KerseyJohn Klavierstuck op 62 no 6 [04:00]
        4 SmithSydney KerseyJohn Aspiration melodie op 208 no 1 [11:00]
        5 AshtonAlgernon KerseyJohn Toccata op 127 no 4 [16:00]
        6 WolfHugo RegerMax KerseyJohn Begegnung [02:03]

        7 HL 126 Stenka Razin choir [10:00]
        8 SF 064 Wentworth choir [10:09]

        9 ReussHeinrich KerseyJohn Andante in G minor [10:01]

        10 SF 060 This Old Man choir piano [12:10]

        11 KopylovAlexander KerseyJohn Feuille d'album in C [07:03]

        12 SF 030 Middleton choir [02:27]

        13 Rosenhain KerseyJohn Romance op 14 no 4 [01:37]
        14 ScholtzHerrmann KerseyJohn Albumblatt op 20 no 3 [12:59]

        XX LS Any hymn [07:12]
        XX HF Any hymn [07:12]
        XX HW Any hymn [07:12]

        15 RudorffErnst KerseyJohn Capriccio appassionato, op 48 [05:14]
        16 Birtwistle Triumph of Time [29:32]

        XX LS Any hymn [07:12]

        Does this match your intention?

        Regards,
        Flo
      • Adrian Worsfold
        Hello Flo This is incredible: indeed yes it is what is wanted. ^!Replace ^.* b(HL|SF|LS|CC|HW|HF|NB) b.*$ r n$0 r n WARS ^!Replace R{3} r n
        Message 3 of 10 , May 26, 2013
        • 0 Attachment
          Hello Flo

          This is incredible: indeed yes it is what is wanted.

          ^!Replace "^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*$" >> "\r\n$0\r\n" WARS
          ^!Replace "\R{3}" >> "\r\n" WARS
          ^!Replace "^\A\R|\R{1,}\Z" >> "" WARS


          How do you actually explain such lines? The point about code with loops and all that is you go down the list and follow the logic, once you've pulled hair out via the Help pages ( "Grr, give an example of how you write it!" is what I say there) or seen how other clips do it and got the code lines to work. Often the practical way is clips that follow menus and those keyboard macros that are somewhat sluggish and unreliable.

          I've looked at the regex pages and notions such as "greedy" mean nothing to me.

          Once again many thanks are due.



          Adrian Worsfold

          http://www.pluralist.co.uk
          http://pluralistspeaks.blogspot.com
          pluralist@...
          26-05-2013
          ----- Received the following content -----
          From: flo.gehrke
          Receiver: ntb-clips
          Time: 2013-05-26, 13:21:33
          Subject: [Clip] Re: Twos and Threes


          [Non-text portions of this message have been removed]
        • flo.gehrke
          ... How do you actually explain such lines? Adrian, Let me just give you an explanation for the first command line: Find ^.* b(HL|SF|LS|CC|HW|HF|NB) b.*$ ...
          Message 4 of 10 , May 26, 2013
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "Adrian Worsfold"<pluralist@...> wrote:
            >
            > ^!Replace "^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*$" >> "\r\n$0\r\n" WARS
            > etc...

            How do you actually explain such lines?

            Adrian,

            Let me just give you an explanation for the first command line:

            Find '^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*$'...
            ^ = start of line
            .* = any character (except NL), zero or more times
            \b = word boundary (between word character and non-word character)
            (HL|...|NB) = alternation (a OR b OR c etc)
            \b = another word boundary
            .* = again any character till...
            $ = end of line

            And replace with...
            \r\n = CRNL
            $0 = the whole match
            \r\n = another CRNL

            From a stricter point of view, one would write:

            ^.+?\b(?:HL|SF|LS|CC|HW|HF|NB)\b.+$

            This is a bit more efficient though, with a few lines, one would hardly notice the difference. At the start of each line, we see at least one character being different from '(HL|...|NB)'. So it makes no sense to search for 'zero'. It's the same condition at end of lines where we've got time data.

            Since there's nothing to store, the alternation could be defined as non-capturing with '?:'. So you may want to replace the RegEx in the above mentioned command line with this better version.

            > Once again many thanks are due.

            It's been a pleasure! It keeps me in practice. I also like the precise requirements you are posting, and the good feedback you give including a full view of what comes out in the end.

            Regards,
            Flo
          • Adrian Worsfold
            Hello Flo (and others) I made a feature of these requirements on my blog too, and has concerned the last four entries, at http://pluralistspeaks.blogspot.com
            Message 5 of 10 , May 26, 2013
            • 0 Attachment
              Hello Flo (and others)


              I made a feature of these requirements on my blog too, and has concerned the last four entries, at

              http://pluralistspeaks.blogspot.com

              because that then links through to my Facebook pages and the people who, sometimes, also use CDs for music in services. I try to do a 'best practice' offering in collecting, editing and storing hymns and acquiring and using incidental music.

              From this I have also made a list maker clip for my own CDs to produce a similar looking list, but different titling and file saving.

              I do put my clipbooks out for others to use, and who knows who looks and gets the drift. They are on my website and the link page to them is now at https://dl.dropboxusercontent.com/u/28120070/pluralist/learning/ictlinks.html for that part that was neglected a little until recently.




              Adrian Worsfold

              http://www.pluralist.co.uk
              http://pluralistspeaks.blogspot.com
              pluralist@...
              27-05-2013
              ----- Received the following content -----
              From: flo.gehrke
              Receiver: ntb-clips
              Time: 2013-05-26, 19:40:54
              Subject: [Clip] Re: Twos and Threes


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