It is currently March 28th, 2024, 5:38 pm

Set Variable Bang

Get help with creating, editing & fixing problems with skins
Post Reply
King Damager
Posts: 9
Joined: December 6th, 2010, 11:44 am

Set Variable Bang

Post by King Damager »

Ok, well it's been a while of me using Rainmeter, and I've written pretty much my own skins that I'm happy with/developing.

Recently I've been looking into the IF Measure, and have actually pretty much got it sorted out, however this is where I want to kind of get the set variable bang sorted and interlinked with this.

Now I've managed to look at the Versaille Skin and the manual so I've got the hang of most of it.

What I really want to try and do is get a measure to set a variable, and then a different measure to pick up on that variable and execute a bang depending on the scenario.

Now I've managed to do the second part of this, however could do with a hand on how to get a measure to set a variable, so for example, the measure returns the time, and sets the time as a value.

Thanks

kd
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Set Variable Bang

Post by Chewtoy »

http://rainmeter.net/cms/Bangs_beta wrote:!RainmeterSetVariable [Variable] [Value] (Config)
Sets a new value for a variable. The meter or measure where the variable is used must have dynamic variables enabled (DynamicVariables=1). Formulas may be used, enclosed in parentheses. As with all !Bangs, quotes must be used around the parameter if there are spaces: !RainmeterSetVariable VarName "(#SCREENAREAWIDTH# - 10)"
!Execute [!RainmeterSetVariable YourVariable [MeasureTime]]
King Damager
Posts: 9
Joined: December 6th, 2010, 11:44 am

Re: Set Variable Bang

Post by King Damager »

Ok, well it's basically the code below

Code: Select all

[TEST]
Measure=Time
Timezone=0
Format="%H%M"
IfEqualValue=#Rise#
IfEqualAction=!Execute [Play XYZ.wav]

[MEASURETEST2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=21600
Url=http://weather.yahooapis.com/forecastrss?p=#WeatherLoc#&u=#WUnit#
RegExp=(?siU)<link.*>(.*)</link>.*city=\"(.*)\".*sunrise=\"(.*)\".*sunset=\"(.*)\".*<image>.*<url>(.*)</url>.*<title>.*:.*m .*(.*)</title>.*lat>(.*)<.*long>(.*)<.*yweather:condition.*text=\"(.*)\".*code=\"(.*)\".*temp=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*high=\"(.*)\".*code=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*high=\"(.*)\".*code=\"(.*)\".*
StringIndex=3
Substitute=" am":""," pm":""
OnRefreshAction !Rainmetersetvariable Rise MEASURETEST2

Should point out that the weather code has been heavily influenced by Enigma whilst I'm here.

Now on top of that I'll have a "Rise" Variable somewhere obviously. But yeah basically I want the StringIndex 3 to be set as a variable (RISE), then my [TEST] Measure to read the Rise Variable and play a sound (which it already does if I set the Rise Variable myself).

Basically the essence of this is that when the sun is rising the computer will play a sound to alert me to this fact. I'll then expand on this for other factors (probably sun setting as well, and various other things) but this is the start point really

kd
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Set Variable Bang

Post by Chewtoy »

The easiest way I see without making it too big is just to have a counter with bangs that sets all the variables you want.

Code: Select all

[SetVarCount]
Measure=Calc
Formula=Counter %6
IfEqualValue=5
IfEqualAction=!Execute [!RainmeterSetVariable Rise [MeasureTest2]][!RainmeterSetVariable SomeOtherVariable [SomeOtherMeasure]]
This will set your varibales as soon as the counter hits 5. It the restarts. You should set it higher though, unless you want to set a new variable that often.
Post Reply