It is currently March 28th, 2024, 2:27 pm

OnChangeAction Added

Changes made during the Rainmeter 2.5 beta cycle and earlier.
Post Reply
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

OnChangeAction Added

Post 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.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: OnChangeAction Added

Post by AlC »

snyderxc
Posts: 17
Joined: January 16th, 2015, 5:51 am

Re: OnChangeAction Added

Post 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?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: OnChangeAction Added

Post 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
snyderxc
Posts: 17
Joined: January 16th, 2015, 5:51 am

Re: OnChangeAction Added

Post by snyderxc »

Ok, great! I'll try it (though I'm using Python, but we'll see!)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: OnChangeAction Added

Post 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
Post Reply