Skip to main content
Topic: Modified clipboard to fix triplets and measure numbers (Read 4086 times) previous topic - next topic

Modified clipboard to fix triplets and measure numbers

I have an early experiment of working on the clipboard in this file: !link(Bar7Ch04.nwc,http://bellsouthpwp.net/w/b/wbport/B147Ch04.nwc).  Using the Semware Editor, I used these programs:

proc Main()
integer curr_line = 2
integer rc = 0
integer measure_number
string buildline[64] = "2 "
Ask("Enter the first measure number: ",buildline)
measure_number = Val(buildline)
loop
GotoLine(curr_line)  //Place cursor at beginning of "curr_line"
GotoColumn(1)
rc = lFind("|Bar","") //Look for next dotted 16th
if rc == 0                  // If we can't find one
break                    // get out of loop
endif
curr_line = CurrLine()      //Save line number of this set
buildline=Format('|Text|Text:"',measure_number,
'"|Font:PageSmallText|Pos:-6|Placement:AtNextNote')
InsertLine(buildline)
curr_line = curr_line + 2
measure_number = measure_number + 1
endloop
end

////////////////// and this one ////////////////////
proc Main()
string sixteenth[10] = "|Dur:16th"
string sixteenthDot[17] = "|Dur:16th,Dotted"
integer curr_line = 2
integer last_line
integer find_one = 0
integer rc = 0
last_line = NumLines() - 4
while last_line > curr_line
GotoLine(curr_line)  //Place cursor at beginning of "curr_line"
GotoColumn(1)
rc = lFind(sixteenthDot,"") //Look for next dotted 16th
if rc == 0                  // If we can't find one
break                    // get out of loop
endif
curr_line = CurrLine()      //Save line number of this set
Down()
GotoColumn(1)
rc = lFind(sixteenthDot,"c") //Look for middle dotted 16th
if rc == 0
find_one = 0
else
find_one = 1
endif
Down()
GotoColumn(1)
rc = lFind(sixteenth,"c")    //Look for last 16th note (last of triplet)
if rc <>0
find_one = find_one + 1  // Will = 3 for a complete set
endif
GotoColumn(1)
rc = lFind("Dotted","c")
if rc == 0
find_one = find_one + 1  // Did not find last one dotted
endif
if find_one == 3  // Found set needing to convert
GotoLine(curr_line)  //Get back to top of set
GotoColumn(1)
Replace(sixteenthDot,"|Dur:8th,Triplet=First","cn")
Down()                //2nd line of set
GotoColumn(1)
Replace(sixteenthDot,"|Dur:8th,Triplet","cn")
Down()                //3rd (last) line of set
GotoColumn(1)
Replace(sixteenth,"|Dur:8th,Triplet=End","cn")
curr_line = curr_line + 3  //Get ready for next set
else
curr_line = curr_line + 1  //That dotted 16th wasn't a triplet
endif
endwhile
end

/////////
There is a lot more work to do, but this is a start at least.

Re: Modified clipboard to fix triplets and measure numbers

Reply #1
I can't write that kind of stuff, but its intent is clear (advantage of the NWC2 clipboard format, also PHP). Good!

Re: Modified clipboard to fix triplets and measure numbers

Reply #2
Those programs may be easier to read here:
http://www.wjporter.com/nwc/

The indented code for certain structures, loops, and conditional instructions didn't show up here.
Since 1998

Re: Modified clipboard to fix triplets and measure numbers

Reply #3
Hi, Warren -

Nice to see another SemWare Editor user.  I've been using various incarnations of editors from SemWare (QEdit up through SemWare Pro) for probably over 15 years now.  Best text editor I ever used and the macro feature has saved my butt (and a lot of time) many times.

Peace,

John

Re: Modified clipboard to fix triplets and measure numbers

Reply #4
While it is quite useful (user since 1991- my first PC), The Semware Editor is an extra expense, so the same functions done with another program might be better.  I have another script which deletes all digits from the clipboard after entering measure numbers in lyrics.  Helps ID the measures where there is an extra or missing hyphen or syllable in a hurry.
Since 1998

Re: Modified clipboard to fix triplets and measure numbers

Reply #5
I've added another macro, "tchange" which prompts the user for the current duration of a song and a new duration.  It is in the link from reply 2.  Tempos from the "Tempo" command and from the "MPC:Tempo" command are converted.  Also in that folder are two versions of the Thais Meditation where I tried to change it from a duration of 3:38 to 5:00.

 

Re: Modified clipboard to fix triplets and measure numbers

Reply #6
Just added "penta.s" to convert 5 16ths to pentuplets.  See earlier link for the file.  This is a script for a Semware editor, but it is documented for those wishing to convert it.  I will be adding two other parts to it for doing the non-pentuplet staff, both played and muted/display only.