Page 1 of 1

OnChangeAction Added

Posted: January 13th, 2013, 4:39 pm
by jsmorley
We have added a new action command to Measures:

OnChangeAction

This allows you to define an action to be taken when the value of a measure changes.

The initial change from "nothing" to a value when the skin is loaded or refreshed is ignored.

Note: With plugins that are "threaded", which includes WebParser and FileView today, the action will fire on the first change when loading or refreshing the skin. This will likely change in the near future.

Re: OnChangeAction Added

Posted: January 15th, 2013, 4:02 pm
by AlC

Re: OnChangeAction Added

Posted: February 19th, 2015, 3:44 pm
by snyderxc
Hey, I was looking for this, but I couldn't find it anywhere. Is there a way to pass the value of the change to the script that I call?

Re: OnChangeAction Added

Posted: February 19th, 2015, 3:56 pm
by jsmorley
snyderxc wrote:Hey, I was looking for this, but I couldn't find it anywhere. Is there a way to pass the value of the change to the script that I call?
[SomeMeasure]
Measure=Whatever
OnChangeAction=[!CommandMeasure ScriptMeasureName """ScriptFunctionName("[SomeMeasure]")"""]
DynamicVariables=1

All the magic quotes / quotes are needed to ensure it works with a Lua function that wants a "string" as an argument. Might be able to simplify it a bit if you just passing a number value to a number Lua function:

[SomeMeasure]
Measure=Whatever
OnChangeAction=[!CommandMeasure ScriptMeasureName "ScriptFunctionName([SomeMeasure])"]
DynamicVariables=1

Re: OnChangeAction Added

Posted: February 19th, 2015, 6:29 pm
by snyderxc
Ok, great! I'll try it (though I'm using Python, but we'll see!)

Re: OnChangeAction Added

Posted: February 19th, 2015, 6:32 pm
by jsmorley
snyderxc wrote:Ok, great! I'll try it (though I'm using Python, but we'll see!)
No, that has nothing to do with any external script.

To execute something external, just use:

OnChangeAction=["PathAndCommandToExecute" "[SomeMeasure]"]
DynamicVariables=1