It is currently March 28th, 2024, 8:17 pm

Setting variable to a measure's value

Get help with creating, editing & fixing problems with skins
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Setting variable to a measure's value

Post by limpet »

I'm trying to use !RainmeterSetVariable to set a variable as a measure's value but all it does is set the variable to the name.
For example: !RainmeterSetVariable HDayDesc1 pHolidayDesc1
This literally sets HDayDesc1 to "pHolidayDesc1".

Ideally I want to use the measure's value in a substitute string. I've looked and looked and haven't found anything similar to this question.
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Re: Setting variable to a measure's value

Post by csm725 »

Try:

Code: Select all

!RainmeterSetVariable HDayDesc1 [pHolidayDesc1]
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Setting variable to a measure's value

Post by limpet »

I had tried that before but it leaves me with a blank when I substitute it in. When I look at the measure in the about box, it shows ".0".
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Setting variable to a measure's value

Post by jsmorley »

limpet wrote:I had tried that before but it leaves me with a blank when I substitute it in. When I look at the measure in the about box, it shows ".0".
You need to use DynamicVariables=1 to use a measure's value with [].
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Setting variable to a measure's value

Post by limpet »

I have that set, too and that's the value I get. Here's the relevant bit of the config:

Code: Select all

[SetDescVars]
Measure = Calc
Formula = 1
IfEqualValue = 1
IfEqualAction = !RainmeterSetVariable HDayDesc8 [pHolidayDesc8]

[cGetTxt04]
Measure = Calc
Formula = cFindHDate04
Substitute = "8":"#HDayDesc8#"
DynmaicVariables = 1

[debug1]
Meter = String
MeterStyle = dayNStyle
MeasureName = cGetTxt04
Text = %1, #HDayDesc8#
X = 220
Y = 100
DynamicVariables = 1
The string ends up showing " , ".

If there's a way of using pHolidayDesc8 in the substitution like "8":"pHolidayDesc8" then that'd be even better.
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
User avatar
JamesAC
Developer
Posts: 318
Joined: July 14th, 2009, 5:57 pm

Re: Setting variable to a measure's value

Post by JamesAC »

You need DynamicVariables=1 under the [SetDescVars] section
+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
Quis custodiet ipsos custodes?
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Setting variable to a measure's value

Post by limpet »

Maybe it doesn't work with a webparser.

The way I'm thinking it should work is like this:
A webparser [pHolidayDesc] grabs a line of text from a text file, then a variable #HDayDesc# gets set a value from the webparser. This variable is used in a substitution for [cGetTxt] which will grab a number from [cFindHDate]. [cFindHDate] runs through the list of holidays and will return weather or not that particular day is a holiday or not (returning a number 1-15 or -1 if not a holiday, out of 15 possible holidays).

It's all very convoluted but so far I've gotten basic holiday support in my calendar now. Just can't get the description so you can actually see what holiday it is.
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Setting variable to a measure's value

Post by kenz0 »

There is a spelling error.
[cGetTxt04]
Measure = Calc
Formula = cFindHDate04
Substitute = "8":"#HDayDesc8#"
DynmaicVariables = 1
.
Image
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Setting variable to a measure's value

Post by limpet »

kenz0 wrote:There is a spelling error.
Doh!

Silly spelling mistakes aside it still refuses to work and gives me a value of ".0". Perhaps I should just post everything I have so far in the skin dev section and let everyone tear it apart and help me fix this problem.
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Setting variable to a measure's value

Post by limpet »

This just occurred to me: would my using version 1.2 rev 440 be the cause of the problem?

I'm going to get the beta and see if this starts to fix things.

Edit:
Good news, everyone!

I don't know if I finally did something I hadn't tried before or if it was the switch to the 1.3 beta but I got it working now.

Code: Select all

IfEqualAction = !RainmeterSetVariable HDayDesc8 "[pHolidayDesc8]"
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]