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

Job done

Expand Messages
  • Adrian Worsfold
    Hello all Thanks everyone. I ended up doing this to extract both titles and lyrics, and it works efficiently. ^!Continue Extracts Titles and Lyrics. Proceed
    Message 1 of 1 , Nov 13, 2012
    • 0 Attachment
      Hello all

      Thanks everyone. I ended up doing this to extract both titles and lyrics, and it works efficiently.

      ^!Continue Extracts Titles and Lyrics. Proceed with a MusicXML file open.

      ^!SetScreenUpdate Off

      ^!Set %working%=^$GetDocName$

      ^!Find "</credit-words>" [S]
      ^!MoveCursor -001
      ^!Find ">" [BS]
      ^!MoveCursor +001
      ^!Set %Filename%=^$GetSelection$

      ^!Set %Type%=.txt

      ^!Replace "(?s).*?(^ *\<credit page\="1"\>.*</credit>).*?\z" >> "$1" RAWS
      ^!Replace "\<.*?\>" >> "" RAWS
      ^!Replace "^ *" >> "" RAWS
      ^!Replace "\R\R+" >> "\r\n" RAWS
      ^!Replace "'" >> "'" AWS

      ^!Select All
      ^!Set %Credits%=^$GetSelection$

      ^!Save As C:\Adrian's Documents\Music\temp.tmp

      ^!InsertFile "^%working%"
      ^!FocusDoc

      ^!Jump Doc_Start

      ^!Set %LyricCounter%="1"

      :GatherLoop
      ^!Set %LyricEnd%="^%LyricCounter%"

      ;long line follows
      ^!Set %Lyrics^%LyricCounter%%="^$GetDocListAll(" *\<lyric number\="^%LyricCounter%"\>\r\n *\<syllabic\>(.*?)\</syllabic\>\r\n *\<text\>(.*?)\</text\>\r\n *\</lyric\>";"$1|$2;")$"
      ;long line precedes
      ^!If "^%Lyrics^%LyricCounter%%" = "" Process
      ^!Inc %LyricCounter%
      ^!Goto GatherLoop

      :Process
      ^!Set %LyricCounter%="1"
      ^!Select All

      :ProcessLoop
      ^!If "^%LyricCounter%" = "^%LyricEnd%" FinishIt
      ^!InsertText Lyrics ^%LyricCounter%: ^%Lyrics^%LyricCounter%%^P
      ^!Inc %LyricCounter%
      ^!Goto ProcessLoop

      :FinishIt
      ^!Replace "^(\d+\x20)(.+)\R\1(.+)$" >> "$1$2\x20$3" WARS

      ^!Jump Doc_Start
      ^!Replace ";begin|" >> " " WAS

      ^!Jump Doc_Start
      ^!Replace "begin|" >> "" WAS

      ^!Jump Doc_Start
      ^!Replace ";middle|" >> "-" WAS

      ^!Jump Doc_Start
      ^!Replace ";end|" >> "-" WAS

      ^!Jump Doc_Start
      ^!Replace ";single|" >> " " WAS

      ^!Jump Doc_Start
      ^!Replace "single|" >> "" WAS

      ^!Jump Doc_Start
      ^!Replace "'" >> "'" WAS

      ^!Jump Doc_Start
      ^!Replace "Lyrics " >> "^P" WAS

      ^!Jump Doc_Start
      ^!Replace ";^P" >> "^P" WAS

      ^!Replace "-" >> "" WAS

      ^!Jump Doc_Start
      ^!InsertText "^%Credits%"

      ^!Replace "^P^P^P" >> "^P^P" WAS
      ^!IfError Next else Skip_-2

      ^!Jump Doc_Start
      ^!DeleteLine

      ^!Jump LINE_END
      ^!Select BOL
      ;End the procedure if the line is empty
      ^!If ^$GetSelSize$ = 0 NONE
      ;Copy the selection into a variable
      ^!Set %Filename%=^$GetSelection$

      :FINALLY
      ^!Save AS "C:\Adrian's Documents\Music\^%FileName%^%Type%"
      ^!DestroyDoc "C:\Adrian's Documents\Music\temp.tmp"
      ^!Jump Doc_End
      ^!SetScreenUpdate On

      ^!Goto END

      :NONE
      ^!SetScreenUpdate On
      ^!Set %FileName%=^?{Give the new document a new working name=_HL ^$GetName(^%working%)$|SF ^$GetName(^%working%)$|HW ^$GetName(^%working%)$|LS ^$GetName(^%working%)$}
      ^!Goto FINALLY

      :END


      The product of this effort is included from here:
      https://dl.dropbox.com/u/28120070/pluralist/spiritual/hymns.html


      Adrian Worsfold

      http://www.pluralist.co.uk
      http://pluralistspeaks.blogspot.com
      pluralist@...
      14-11-2012
      ----- Received the following content -----
      From: Don
      Receiver: ntb-clips
      Time: 2012-11-13, 22:41:03
      Subject: Re: [Clip] The Rubbish Way to Do It


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