NWC2 Scripts - Global Modification


Author: Andrew Purdam

Comments to NoteWorthy Composer Forum

Download: v1.0.2 2/12/04


(Rightclick and Save Target As... to your NWC2 Scripts folder as global_mod.php)

Briefly: Globally modify particular components in a staff.
Usage: php global_mod.php <type>,<comparison>,... <action>
Parameters:
type
required. eg Note, Rest, Chord, Tempo, etc
comparison
optional, of the form <opt>, meaning the named option is present or
<opt>==<value>, meaning that <opt> is the given value, or value is present if opt is an array. or
<opt>!=<value>, meaning that the single value of opt is not equal to value. Ditto >, >=, <, and <=
NB: If <opt> is <opts>.<subopt> it will deal with subopt as a subtype of opt.
eg Dur.Dotted or Opts.VertOffset>=0
action
is either
DELETE - delete the object
<opt>=<val> - set option to val
<opt>+=<val>, add val to option, also -=, *=, /=
Again, opt can be of the form <opt>.<subopt>
And there can be more than one pair of match/action, allowing you to build quite complex modifications.
Additional Help :
Global Modification  Invocation Instructions   These are pdf documents
Comments: examples:
To adjust all whole rests up two
php global_mod.php Rest,Dur==Whole Opts.VertOffset+=2

or to modify all tempos to slow by 10%
php global_mod.php Tempo Tempo*=0.9

or to hide all tempo markings
php global_mod.php Tempo Visibility=Never

or even a rudimentary inversion

(this example around the space above middle line)


php global_mod.php Note Pos-=1 Note Pos*=-1 Note Pos-=1

Known issues: altering positions might not work with accidentals.
History: 1.0.2 Added message for empty input