It is currently November 19th, 2018, 8:12 am

OnChangeAction Added

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

OnChangeAction Added

jsmorley » January 13th, 2013, 4:39 pm

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: 331
Joined: June 9th, 2011, 6:46 pm

Re: OnChangeAction Added

AlC » January 15th, 2013, 4:02 pm

Rainmeter - You are only limited by your imagination and creativity.
snyderxc
Posts: 17
Joined: January 16th, 2015, 5:51 am

Re: OnChangeAction Added

snyderxc » February 19th, 2015, 3:44 pm

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: 18330
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: OnChangeAction Added

jsmorley » February 19th, 2015, 3:56 pm

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

snyderxc » February 19th, 2015, 6:29 pm

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

Re: OnChangeAction Added

jsmorley » February 19th, 2015, 6:32 pm

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