I wrote the following little script to insert a collapsible MMR in one go (instead of five separate components)
'Save as ColMMR.vbs
'Command WScript Scripts\ColMMR.vbs <PROMPT:BarCount?=#>
'Writes out a collapsed MMR
Set StdOut = WScript.StdOut
Set Args = WScript.Arguments
With StdOut
.WriteLine "!NoteWorthyComposerClip(2.5,Single)"
.WriteLine "|Boundary|Style:Collapse"
.WriteLine "|Bar"
.WriteLine "|RestMultiBar|NumBars:" & Args.Item(0) & "|WhenHidden:ShowBars,ShowRests"
.WriteLine "|Bar"
.WriteLine "|Boundary|Style:EndCollapse"
.WriteLine "!NoteWorthyComposerClip-End"
End With
and encountered two snags.
You have to replace a dummy item (say a rest) or else it replaces the whole staff. I could process the whole StdIn stream to fix that, but if I'm inserting it, how do I know where the cursor is?
More importantly "Repeat User Tool" does precisely that. It doesn't re-prompt for the number of bars. :-(
Edited because the default MMR has "ShowRests" and "ShowBars" set, but if you miss these off the clip then they are not set!
With 'Clip Text', you don't, so processing the stream won't help.
Not if the user specifies Input Type: File Text
You might try this approach:
Option Explicit ' rg_ColMMR.vbs Ver 1.00, Rick G.
' Reference: http://my.noteworthysoftware.com/?topic=8564.0
' Prompt: <PROMPT:BarCount?=#[1, 255]>
' Input Type: File Text
' a few PHP defines from nwc2clips.inc:
Const NWC2_STARTFILETXT = "!NoteWorthyComposer"
Const NWC2_STARTCLIP = "!NoteWorthyComposerClip"
Const NWC2_ENDCLIP = "!NoteWorthyComposerClip-End"
Dim s
Do Until WScript.StdIn.AtEndOfStream
s = WScript.StdIn.ReadLine
If InStr(s, NWC2_STARTFILETXT & "(") = 1 Then Exit Do
If s = NWC2_ENDCLIP Then
WScript.StdErr.WriteLine " Tool requires Input Type: File Text"
WScript.Quit
End If
Loop
s = Replace(Replace(s, NWC2_STARTFILETXT, NWC2_STARTCLIP), ")", ",Single)")
With WScript.StdOut
.WriteLine s ' the header
.WriteLine "|Boundary|Style:Collapse"
.WriteLine "|Bar"
.WriteLine "|RestMultiBar|NumBars:" & WScript.Arguments(0)
.WriteLine "|Bar"
.WriteLine "|Boundary|Style:EndCollapse"
.WriteLine NWC2_ENDCLIP 'the footer
End With
Yes, that does the trick. Thanks.