Friday, 24 May 2013

Hair Pulling Clip Making

Forget the previous entry. This is an improvement thanks to a little outside assistance and some of my hair pulling brain effort.

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

^!Replace "\x20+$" >> "" ARSW
;Merge sections
^!Replace "^(\d+)\R(.+)\R(\d.*:.*)$" >> "$1 $2 $3" ARSW

^!Clip "Sorting numbers zeros"

^!Jump Doc_Start
^!Replace "00^P01" >> "^P01" S

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

^!Replace " 00:" >> " " WAS
^!IfError Next else Skip_-1

^!Replace ".0^P" >> "^P" WAS
^!IfError Next else Skip_-1

^!Save As "C:\Shared Documents\Music\^%Filename%.txt"

^!SetScreenUpdate On


That's a big improvement, and so is the following for putting square brackets over timings on a list of tracks. It actually calculates how many square brackets to put in and does. Blank lines removal was put into the clip above, but is important for how this clip works. This clip is separate from the one above because not all timings are 5 digits including the colon and this is easier via human intervention (or a clip would have to remove any tenth of second number and increase the second by one and present a clean 5 digit number each line!! Shall I ask?). Absence of slow ^!Keyboard commands means there isn't a tendency to fail when running at speed:

^!Continue Must place on first line of timings to bracket them.
^!ClearVariables
^!Set %Pos%=^$GetTextLineCount$
^!Set %Lines%=^$GetParaRow$
^!Set %Bracket%=^$Calc(^%Pos%-^%Lines%)$

:LOOP
^!Inc %Count%
^!Jump LINE_END
^!InsertText "]"
^!MoveCursor -006
^!InsertText "["
^!Jump LINE_START
^!Jump +001
^!IfError END
^!If ^%Count% > ^%Bracket% END
^!GoTo LOOP

:END

I've sent a request. If there are clever people that can round up tenths of seconds to seconds and minutes when necessary and produce a neat result automatically then it will be a clip inserted into the second one and may be all combined into one clip, thus taking raw data and producing a finished product in a flash. But it's beyond my kind of brain.

No comments: