Skip to main content

Topic: "Extend staff below with rests to cursor" user tool (0.1) (Read 365 times) previous topic - next topic

"Extend staff below with rests to cursor" user tool (0.1)
I have written a small user tool that extends a staff with invisible rests - this is e.g. useful if a staff needs a layered staff late in the score.

Here is a short description:
This simple tool fills the staff below the active staff with invisible rests up to the cursor position on the active staff.
The following items are copied down from the active staff: All sorts of bars, flow controls, endings, time signatures, and keys. These copied objects keep the visibility from the active staff.
The tool never inserts whole rests, as their duration is not fixed (but dependent on time signature and other items in a bar). It also never creates dotted rests.
If the staff below the active staff extends past the cursor position, or there is no staff below the active staff, the score is not altered.
Like all staff-changing tools, it requires that the staff is saved before the tool is called; and there is no undo (but one can quickly revert to the saved file with Alt-F R).

To install, download the attached lua file (wherever you want to store user tools), open some NWC score (e.g. a new one), go to "Tools --> User Tools", click "New" and add the following:
  • Group: Whatever you want to keep your user tools organized
  • Name: "Extend staff below with rests to cursor"
  • Command: Browse to location where you saved the downloaded file
  • Input Type: File Text
  • Options: Returns File Text

I have also attached a weird test file to play around with this tool.

A companion tool "Remove following rests of same length" can help you if you want to insert new notation in the rest stretches, but want to re-align parts after the inserted pieces (NWC has no "overwrite mode", so inserting notation without disturbing the position of staff parts to the right is not possible "out of the box").

(I have not researched whether there are already other tools that can be used for this purpose ... I wanted a very simple tool, both from the viewpoint of usage - no options - and code - as short as possible, and I need to learn to write user tools in Lua anyway, so I took this as a first example).

H.M.
  • Last Edit: 2018-05-27 06:39 pm by hmmueller