Hi Mark, Glad to be of assistance. I just took another look at it, and realized that there's still a case where my algorithm didn't work: when the lyrics under the chord are shorter than the chord. The following adapted version should fix that for you:
## on mouseUp put ChordProPrintText(field "ChordProText") into field "PrintText" end mouseUp private function ChordProPrintText pChordProText local tPrintText, tLine, tIndex, tInBracketFlag, tChords, tLyrics repeat for each line tLine in pChordProText put empty into tChords put empty into tLyrics put false into tInBracketFlag repeat with tIndex = 1 to the number of characters in tLine if char tIndex of tLine is "[" then put true into tInBracketFlag if tChords is not empty and char -1 of tChords is not space then put space after tChords end if repeat (the number of characters in tChords) - (the number of characters in tLyrics) times put space after tLyrics end repeat else if char tIndex of tLine is "]" then put false into tInBracketFlag else if tInBracketFlag is true then put char tIndex of tLine after tChords else put char tIndex of tLine after tLyrics if the number of characters in tChords < the number of characters in tLyrics then put space after tChords end if end if end repeat put tChords & return & tLyrics & return after tPrintText end repeat return char 1 to -2 of tPrintText -- no trailing return end ChordProPrintText ## Cheers, Jan Schenkel. ===== Quartam Reports & PDF Library for LiveCode www.quartam.com ===== "As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld) ________________________________ From: Mark Stuart <mfstu...@cox.net> To: use-revolut...@lists.runrev.com Sent: Tuesday, November 8, 2011 5:49 PM Subject: Re: Formatting ChordPro music charts Jan, you are brilliant. Thank you very much for the script, it works exactly as expected. Even with chords like Dsus2, F#, Bb, Cm7, etc. So thanx again. Now to finish this project... another story. Regards, Mark Stuart _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode