Skip to main content
Topic: Using Global Mod to turn off certain attributes (Read 20919 times) previous topic - next topic

Using Global Mod to turn off certain attributes

The Global Mod tool appears to be just what I want (many thanks to Andrew) but I couldn't find out how to turn off some of the attributes that can be set.

In particular, I can set Stem=Down or Stem=Up but I can't see how to reset it to the default value.  I know that I can do it pretty easily outside the user tool using Tools\Audit Note Stems but I wanted to be able to reset the stem direction at the same time as resetting XAccSpace, XNoteSpace, Ties and Slur directions (for which 'Default' is a valid option). I tried "Note,Pos>=0 Opts.Stem=Down Note,Pos<=-1 Opts.Stem=Up" but this didn't seem to behave as would expect (occasional notes left with an unexpected stem direction) and, anyway, I wanted to remove the explicit stem direction not just change it.

This example is the most important for my use but I also find that I can't turn off ArticulationsOnStem (use "Note Opts.ArticulationsOnStem=" to turn it on) or 'override stem length' (which appears to be set automatically if the stem length attribute is set explicitly).
 
I wondered whether there was a similar behaviour with other tick boxes and, although I didn't try them all, I found that the 'Preserve Width' attribute for text items can be turned on  "Text Wide=Y" and off "Text Wide=N"

Any help would be welcome.
 

Re: Using Global Mod to turn off certain attributes

Reply #1
G'day David,
to remove the stem direction try:
Note Opts.Stem=

To remove the articulations from the stem try:
Note Opts=!ArticulationsOnStem

To remove a stem length override:
Note Opts.StemLength=

If you can assign a null value, it will reset the current assignment, if it is just a checkbox then the Opts=!whatever construct will probably work...  At the very least, the expressions above work OK.

I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Using Global Mod to turn off certain attributes

Reply #2
G'day in return!  Many thanks.
I tried a variety of options but clearly not the right one.

Re: Using Global Mod to turn off certain attributes

Reply #3
One thing that might help in the future to do a global mod is to see what code NWC generates for what you want on the clipboard.  Copy a note (rest, other object, etc.) and itsert it next to the original and change the attribute(s) you want.  Select both to the clipboard and run a text editor with the copied text.  Note the difference(s) and figure out a way to make just those changes globally.
Since 1998

 

Re: Using Global Mod to turn off certain attributes

Reply #4
Warren has hit the nail on the head.
Sometimes just looking at the text representation and using a text editor is easiest.
As David said, there are many slight variations in how attributes are shown, but to try and catalogue all of them would be tedious.
I had to leave it as an exercise for the reader.
I think if I write any more user tools I'd possibly just use a text manipulator rather than the whole PHP library.
However, some "applets" will still benefit from PHP's OOB approach. (I'm still thinking of a random note generator).
I just wish there was an easy way to do dialogs of parameters. The current method is pretty ordinary.

Re: Using Global Mod to turn off certain attributes

Reply #5
One thing that might help in the future to do a global mod is to see what code NWC generates for what you want on the clipboard.  Copy a note ... insert it ... change the attribute(s) you want.  Select both to the clipboard and run a text editor with the copied text.  Note the difference(s) and figure out a way to make just those changes globally.
That was pretty well what I tried to do and I suggest that it will work very well for every attribute that is represented explicitly in the text for both notes. In the case where one note doesn't mention the attribute (e.g. "|Note|Dur:4th|Pos:-3|Opts:Stem=Down" and "|Note|Dur:4th|Pos:-3") then I had to try a few variations to try to turn it off.
It was interesting to see the slight variation of syntax to turn off 'ArticulationsOnStem' and Stem Direction.
I'm almost tempted to embark on the catalogue of all attributes.  Perhaps when the grass has stopped growing and that paint has dried properly...

Re: Using Global Mod to turn off certain attributes

Reply #6
It helps to have a text editor which supports what is called "regular expressions".  This gives you the chance to group what you are looking for, including wild cards, and specify separately what you want to change.   For example search for

Code: [Select · Download]
\(Note.*\)Stem=Down
and replace it with
Code: [Select · Download]
\1Stem=Up

This searches for "Note" and other stuff ending with "Stem Down".  "Note" and other stuff is copied intact and "Stem=Up" will be the only change.
Since 1998