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

Re: Re: [Clip] Extracting text from a music .XML file.

Expand Messages
  • Adrian Worsfold
    Hello all I did think it would be something of a hare to chase or a jigsaw. I receive you latest efforts, plug them in and replace other in a copied clip, but
    Message 1 of 47 , Nov 14, 2012
    • 0 Attachment
      Hello all

      I did think it would be something of a hare to chase or a jigsaw. I receive you latest efforts, plug them in and replace other in a copied clip, but when they fail I keep the working version.

      So far this is the working version:

      ^!ClearVariables

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

      ^!SetScreenUpdate Off

      ^!Set %working%=^$GetDocName$

      ^!Find <lyric number [s]
      ^!IfError ^!Set %Lyricscontent%="none"



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

      ^!If ^%Lyricscontent%="none" NEARLY

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

      :NEARLY
      ^!Jump Doc_Start
      ^!DeleteLine

      ^!Jump LINE_END
      ^!Select BOL
      ;End the procedure if the line is empty
      ^!If ^$GetSelSize$ = 0 EMPTY
      ;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

      :EMPTY
      ^!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




      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-14, 12:12:28
      Subject: Re: [Clip] Extracting text from a music .XML file.


      [Non-text portions of this message have been removed]
    • Adrian Worsfold
      Hello flo Brilliant. Later on today I will alter the clip and instructions on my webpage. How you have managed to account for different line lengths in verses
      Message 47 of 47 , Nov 16, 2012
      • 0 Attachment
        Hello flo

        Brilliant. Later on today I will alter the clip and instructions on my webpage. How you have managed to account for different line lengths in verses baffles me but thanks and I'll give appropriate thanks on the webpage when I re do it, including your further advice.




        Adrian Worsfold

        http://www.pluralist.co.uk
        http://pluralistspeaks.blogspot.com
        pluralist@...
        16-11-2012
        ----- Received the following content -----
        From: flo.gehrke
        Receiver: ntb-clips
        Time: 2012-11-16, 13:42:25
        Subject: Re: [Clip] Extracting text from a music .XML file.


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