Skip to main content
Topic: Help with Global_Mod (Read 3665 times) previous topic - next topic

Help with Global_Mod

It used to be me helping people with Global_Mod issues, now I need some help...

With the advent of the new User Objects in NWC2.75, I needed to make a change to some Arpeggio objects I'd used.

A dump from the "Variable Dump For Developers" tool gave me this:
Code: [Select · Download]
A text representation of the NWC2ClipItem object for each clip line is shown below. This was generated using NWC2Clip Version 2.51.

NWC2ClipItem Object
(
    [ObjType] => Clef
    [Opts] => Array
        (
            [Type] => Treble
            [Fake] =>
        )
)

NWC2ClipItem Object
(
    [ObjType] => Chord
    [Opts] => Array
        (
            [Dur] => Array
                (
                    [Whole] =>
                )
            [Pos] => Array
                (
                    [0] => -6
                    [1] => -4
                    [2] => -2
                    [3] => 1
                )
            [Fake] =>
        )
)

NWC2ClipItem Object
(
    [ObjType] => User
    [Opts] => Array
        (
            [Arpeggio.ms] =>
            [Pos] => 4
            [Speed] => 4
            [Fake] =>
        )
)

NWC2ClipItem Object
(
    [ObjType] => Chord
    [Opts] => Array
        (
            [Dur] => Array
                (
                    [Whole] =>
                )
            [Pos] => Array
                (
                    [0] => -6
                    [1] => -4
                    [2] => -2
                    [3] => 1
                )
            [Fake] =>
        )
)

The relevant portion is this:
Code: [Select · Download]
NWC2ClipItem Object
(
    [ObjType] => User
    [Opts] => Array
        (
            [Arpeggio.ms] =>
            [Pos] => 4
            [Speed] => 4
            [Fake] =>
        )
)

With a Global_Mod command of:
User Speed=8
I was able to change the speed successfully BUT it also added a "Speed" parameter to all the other non Arpeggio.ms user objects on the staff  :(

I tried every syntax I could think of to specify ONLY Arpeggio.ms objects to no avail.
E.G.
User,Opts.Arpeggio.ms Speed=8
User,Opts.Arpeggio\.ms Speed=8
User,Arpeggio.ms Speed=8
User,Arpeggio\.ms Speed=8
User,Opts.Arpeggio.ms== Speed=8
User,Opts.Arpeggio\.ms== Speed=8
plus a bunch of others I can't remember...

Any suggestions?
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too

Re: Help with Global_Mod

Reply #1
You may try: 'User,Speed Speed=8'
It will modify only objects that have a 'Speed' parameter. :)
Unfortunately >:( , as a consequense, the arpeggio objects with a default 'speed' will not be modified, because they don't have that parameter.
Always look on the bright side of life!

Re: Help with Global_Mod

Reply #2
You may try: 'User,Speed Speed=8'
It will modify only objects that have a 'Speed' parameter. :)
Unfortunately >:( , as a consequense, the arpeggio objects with a default 'speed' will not be modified, because they don't have that parameter.
Thanks Opagust - that idea had slipped my mind...

The problem with default speed may well turn out to be an annoyance.  Still we have a start.
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too

Re: Help with Global_Mod

Reply #3
I have never used this Global_Mod user tool, so please explain my ignorance... but if your goal is to change Speed=8 to all of the Arpeggios in a selection, why not use Filtered Properties to do this (using a Filtered Expression of "|User|Arpeggio.ms")?

Edit: I see now that Global_Mod will operate on the entire file, rather than a single selection, which is the case for Filtered Properties.

Re: Help with Global_Mod

Reply #4
Hi Mike,
Global_Mod is a user tool from the dark ages of user tool development, right from the very start of user tool availability in the V2 alpha and beta tests. - it is very, very flexible and I use it a LOT.

I feel there must be a way to use it for modifying User objects if I can just figure out the correct syntax..

It is possible that the escape character ("\" used for escaping commas) may need to be expanded to escape "." (periods) as well.
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too

Re: Help with Global_Mod

Reply #5
Hi Lawrie,

I suspected that Global_mod was a very old tool, given that it's written in PHP. I wasn't suggesting that you quit using it, but was just saying that for the task at hand, Filtered Properties might be an answer; it was most likely not a feature when Global_Mod was created.

I will experiment with the tool to see if I can come up with syntax options that work with custom objects. You are probably on the right track with the "." since that is a wildcard character in regular expressions. There is still the issue that @Opagust mentions, about being able to add the Speed parameter if it is not already present, and change it if it is. But I would suspect that Global_Mod would know how to do this, since NWCTXT behaves this way for a number of native objects (i.e. it excludes elements or values that are in their default state)

Mike

Re: Help with Global_Mod

Reply #6
Hi Mike,
actually, Global_Mod predates NWCTXT, doesn't really use it.

The data structure that Global_Mod works with is available from the Variable Dump tool - you used to be able to copy and paste objects into notepad and that would also give good syntax clues, but there was a change that made pastes into notepad match NWCTXT instead - made it a little harder...  :(

I'm hoping Eric might chime in given Global_Mod's author, Andrew Purdam, hasn't been around the forum for many years...

Lawrie
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too

Re: Help with Global_Mod

Reply #7
I just did a search online, and I think I found the source for Global_Mod here. It looks like the current (2011) version has been updated by Eric to support nwctxt:

//  2011-12-19 2.1 nwsw Support most nwctxt objects

I'm not at my NWC computer right now, but I have a few ideas on making this work. One is that the User object type (i.e. Arpeggio.ms) is not being seen by the tool as an "option" because it doesn't have a value associated with it, as other options do (i.e. there is no ":" present)

Since Eric has made changes to this tool before, he may know exactly what's needed to make it handle User objects.

Re: Help with Global_Mod

Reply #8
Okay, I have looked at the PHP code a bit, and I think this might work:

User|Arpeggio.ms Speed=8

But it is only an educated guess, since I can't actually run it to try it yet. If you want to give it a shot, let me know if it does work. It should change all Arpeggio.ms Speed to 8, whether or not the speed is set explicitly already (i.e. whether or not it is the default value).

But it's only a guess that it will work! Did I say that?

Thanks,
Mike

Re: Help with Global_Mod

Reply #9
Okay, I have looked at the PHP code a bit, and I think this might work:

User|Arpeggio.ms Speed=8
But it is only an educated guess, since I can't actually run it to try it yet.
I did try and it doesn't work.

I looked at the help text and found:
Quote
NB: If <opt> is <opts>.<subopt> it will deal with subopt as a subtype of opt.
eg Dur.Dotted or Opts.VertOffset>=0
So maybe the script handles it as if 'ms' is a <subopt>  of the <opt> 'Arpeggio'

P.S. Some time ago I started to write a Lua script to do global modifications, using a dialog to specify conditions and action. But I abandoned it after a while. Maybe I will take it up again. No promise though.
Always look on the bright side of life!

Re: Help with Global_Mod

Reply #10
With a Global_Mod command of:
User Speed=8
I was able to change the speed successfully BUT it also added a "Speed" parameter to all the other non Arpeggio.ms user objects on the staff  :(
I tried every syntax I could think of to specify ONLY Arpeggio.ms objects to no avail.
Any suggestions?
Use 'Filtered Properties' instead.
To change all Speeds, use:
Quote
|User|Arpeggio.ms
as the filter.

To change only Speeds where Speed is present, use:
Quote
|User|Arpeggio.ms*|Speed:
as the filter.

You might think that to change only Speeds where Speed is set to 4, you could use:
Quote
|User|Arpeggio.ms*|Speed:4
as the filter. Perhaps not. This would also include speeds of 4.2, 4.5, 40, 40.5, etc.
I'll look at GlobalMod. IMO, GlobalMod needs to work with User Objects. There will be times when I want to add to or multiply a numeric value and that is beyond the abilities of 'Filtered Properties.'

Registered user since 1996

Re: Help with Global_Mod

Reply #11
Version 2.75 of the start kit is pending.

I changed adp_GlobalMod.php to support User object types by separating with a colon. Here is a quote from the new help text:

Quote
or to move all GuitarChord.ms objects to a new position
   php global_mod.php User:GuitarChord.ms Pos=12

Re: Help with Global_Mod

Reply #12
you used to be able to copy and paste objects into notepad and that would also give good syntax clues, but there was a change that made pastes into notepad match NWCTXT instead - made it a little harder...  :(
Select one item
Press F3
Copy the contents of 'Find What:' to the clipboard.
Registered user since 1996


Re: Help with Global_Mod

Reply #14
Thanks everyone, and especially Eric with the new starter kit.  Works a treat, except...  :)

This syntax:

User:Arpeggio.ms,Speed==n Speed=x

works fine for all BUT Speed==32 (which is the default)  Not sure how to get around this without modifying Arpeggio.ms to store the default speed in the object as a parameter (as when it is changed from the default).

Probably not going to be a big enough deal to worry about, except that newbies may get confused about it.

Again, thanks everyone :)
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too


Re: Help with Global_Mod

Reply #16
Oh, of course - It's been a while since I had to figure out syntax fo GM - most of the commands I use regularly are setup as separate user tool entries.

Thanks mate :)
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too