A support incident with the TremoloSingle.ms (https://forum.noteworthycomposer.com/?topic=9085.0) object type led to the attached user tool. This user tool can be run in Clip or File Text modes. When run in file mode, it returns file text.
This tool attaches all instances of the designated user object type to the target note that follows it, skipping any rests or bar lines that separate the object from its target note. This has been designed to work with TremoloSingle.ms
objects, but would work for other objects that specifically target notes, and not rests or bar lines.
In version 2.75a, you can install this tool directly from Tools, User Tools, Download
by entering its name at the prompt:
Attach Objects To Next Note.nw
Given this input:
the tool will produce this result:
Currently, TremoloSingle.ms (and a number of my other objects) are a bit lax when it comes to placement of the object relative to the note/chord they affect. In most cases, the object will work fine if it is not immediately followed by the note/chord, but if there are rests or bar lines between the two, the object might not be drawn or played, or could even throw an error.
I will be making changes to TremoloSingle (and other objects) soon, that will enforce proper placement relative to the notes/chords being ornamented and played. If there are intervening rests or bars, drawing and playback of the object will be suppressed, and an error indication will be displayed instead, to alert the user that corrective action is needed. The user tool in the parent post can be used to scan scores for such cases and "fix" them.
If you have any questions or suggestions about this, please let me know.
Updated to return the number of object instances that were actually moved. The return report now looks like this:
Results for TremoloSingle.ms (file mode)
Objects found: 390
Objects moved: 85
Objects deleted: 0