Skip to main content
Topic: Dialog based Global Modification Tool: GlobalMod.og (Read 13767 times) previous topic - next topic

Dialog based Global Modification Tool: GlobalMod.og

This tool is inspired by the 'Global Modification (adp) tool from the User Tool Starter Kit. The purpose is identical: search for certain objects with certain properties within a staff or a selection and do some 'global' modifications (are remove them).
But here you don't need to know how to construct a global modification expression. It's completely dialog driven.
You'll be asked for a type and then you can specify 0 or more conditions and the desired action(s): delete or do 1 or more modifications.
No knowlegde is required of how an object or property is represented within NWC. Just select what you want from the selection lists.

Limitations:
- no modification possible on individual notes in chords and restchords;
- multi-point controller and instrument change are not supported.

Installation:Download the attached file and drag and drop it upon any open NWC file
Any suggestions or bug reports are welcome!

21/10/2016: Bug fix (An error occured when processing an object with empty conditions).

Gust

07/07/2016: replaced by new version (1.1), using nwc.txt where possible, as suggested by NoteWorhy Online.

12/07/2016: Replaced by new version(1.2): A new functionality has been added: save the parameters and reuse them on another staff or file.

After specifying your parameters, you have the opporunity to save and reuse them.
To do so I created a new User Object 'GlobModParms.og', that you can download here: https://forum.noteworthycomposer.com/?topic=9385.
If you choose to save your parameters, such an object is inserted by the User Tool in front of your clip input, with a description text you specify. You can then copy it and paste it elsewhere.
If the tool is run with on or more User Objects 'GlobMod.Parms' in the clip input, you'll have the choise for each of them: process that User Object or not. If none is to be processed, you'll have to specify new parameters.

01/03/2017: Version 1.2.2 (see reply #8 for more details)
26/03/2017: Version 1.2.3 (see reply #16 for more details)
07/09/2017: Version 1.2.4 (see reply #17 for more details)
Always look on the bright side of life!

 

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #1
Nice work...you might consider using the nwc.txt options, where possible. For example:

Code: (Lua) [Select · Download]
local function toParmString(fld)
 local s = StringBuilder.new()
 for _,v in ipairs(nwc.txt[fld]) do s:add('|',v) end
 return tostring(s)
end

local Values = {
Text = "*",
Visibility = toParmString('ItemVisibility') ,
Color = toParmString('ItemColor'),
['Dynamic.Style'] = toParmString('DynamicLevels'),
['DynamicVariance.Style'] = toParmString('DynamicVariance'),

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #2
Since it's a user tool, I would have called it og_GlobalMod.lua.
There is not an official standard, but...

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #3
Since it's a user tool, I would have called it og_GlobalMod.lua.
There is not an official standard, but...

I'd like to know the opinion of 'NoteWorthy Online' concerning naming User Tools.
Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #4
The user tool naming is evolving. I'll have to get back to you on that...

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #5
Nice work...you might consider using the nwc.txt options, where possible.

See replaced version in original post.

Gust


Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #6
A new functionality has been added: save the parameters and reuse them on another staff or file.
In the original version, if you wanted to do the same global modification on another staff or file, you would have to go through the whole dialog again. That wasn't very user friendly.
So now you have the opporunity to save your parameters and reuse them.
To do so I created a new User Object 'GlobModParms.og', that you can download here:  https://forum.noteworthycomposer.com/?topic=9385..
If you choose to save your parameters, such an object is inserted by the User Tool in front of your clip input, with a description text you specify. You can then copy it and paste it elsewhere.
If the tool is run with on or more User Objects 'GlobMod.Parms' in the clip input, you'll have the choise for each of them: process that User Object or not. If none is to be processed, you'll have to specify new parameters.
So you can create your own favorite 'globmodparms' and store them in a template file. Or you could place them in a custom selector on your toolbar, like I did, see attachment.
A short description of my favorites:
- Visible flows : 5 globmods:
   - 4 for changing the color to red for repeat bar lines;
   - 1 for flow directions (Segno, AlCoda,...): make them red, wide, always visible and on position 0.
- Red Dynamics
- Crescendo diminuendo Color: Green for crescendo, magenta for decrescendo.

Note: The custom selector files are stored in the Config Files folder and have names from 100.nwc for selector 1 onto 10f.nwc for selector 16. I've put mine in selector 14.
Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #7
I discovered and fixed a bug: An error occured when processing an object with empty conditions.
New version in original post.
Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #8
Version 1.2.2
- Attempt to make this tool more user friendly
   * Presenting only the Object Types that are present in the selection or active staff
   * Presenting the items of the selection lists in alphabetical order
   * Additional helpscreen when prompting for saving the parameters
- Correction of a bug when modifying triplets

Installation:
- Download the new version from the original post
- Drag and drop it upon any open NWC file.
Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #9
Hi Opagust,

Cudos for this idea.  I didn't download previous versions - but you have now caught my interest.

But I may be doing something wrong.

I have installed your lua file in scripts.  When I run it, I get a dialog box.
The dialog box asks for Execution mode.
Options appear to be  "Do a global Modification" or "Help"
I select "Do a Global Modification"   Then I get object type to Modify, which is populated with items according to the selection.
I select an object type .......  

To cut a longer story short  I continue going through the dialog options and at some point, not always the same point, I get the error screen with stdout selected.

After experimenting a bit, I discover that I get this if I just simply leave the screen on the very first dialog box (Select Execution Mode) .

So OK, what have I done wrong ?

Thanks
Rich.

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #10
Hi Richard,
Can you attach an image of the error screen?
Always look on the bright side of life!


Re: Dialog based Global Modification Tool: GlobMod.og

Reply #12
What version of NWC do you use?
What do you see if you click on 'STDERR'?
I attach a testversion which shows some info in STDERR, so can you download and run it? (on a small selection to reduce the output in STDERR).
Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #13
OK, Apologies. I have cured the problem.

I installed in the way that you suggested in the original post instead of installing in the same way as I have installed all other lua files.

Mental note to self ...  read the post don't assume !!!!



Rich.

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #14
Sorry, Rich, I'm lost.
Are you saying that there is a difference if you install a tool by dropping it instead of sing the "new" button in the User Tools dialog?

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #15
In this case, it seems there was - however, it's been a while since I installed a tool and so I must have made a mistake somewhere.
Stupidly, I didn't keep old and new to see what the difference was.

Rich.

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #16
Version 1.2.3 : Correction of 2 bugs
- Prompts for numerical values didn't work anymore
- Modification of vertical offset in special endings: incorrect property name

See attachment in original post
Installation:
- Download the new version from the original post
- Drag and drop it upon any open NWC file.
Always look on the bright side of life!

Re: Dialog based Global Modification Tool: GlobMod.og

Reply #17
Version 1.2.4 :
 - If 1 or more User Objects GlobModParms are present, you can specify whether they should be processed (for each of them) and/or if you want to process a new set of parameters.
 - Correction or a bug for inserting 'Endings'.

See new attachment in original post.
Remark: you need NWC version 2.75 or higher.
Always look on the bright side of life!