Friday 24 May 2013

Aren't They Clever!

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
^!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^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 using 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

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]

No comments: