It is currently May 9th, 2024, 6:48 am

Font Colour Variables

Get help with creating, editing & fixing problems with skins
mazty
Posts: 7
Joined: January 1st, 2012, 4:44 am

Font Colour Variables

Post by mazty »

Currently I'm making a skin which runs one web parser, and from that 16 child parsers which display 16 values which are either "0", "+#value" or "-#value#".

Here's a child parser & display:

Code: Select all

[MeasureChild1]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureParent]
StringIndex=1
RegExpSubstitute=1
Substitute='</span>' : "", '<span.*>':""

[All_1_Sov_1]
Meter=STRING
MeasureName=MeasureChild1
FontColor=#Sov1Colour#
meterStyle=stylePOS
DynamicVariables=1
X=172
Y=49
Now I would like to change the colour of the value showed but am running into several problems.

The first is that trying to use an "IfEqualValue" etc command for the child parser value doesn't work as the + or - prefix means that the follwing number is ignored, in essence making the Calc see all values as 0.

The second problem is that with the child parser I can't seem to remove the + or - prefix in a second child parser as the RegExpSubstitute=1 seems to not function well with numerical operator symbols

I do have a work around for it, but it is very long winded and bumps the size of the script up dramatically as I'd have to have 3 measures of each value, so 48 measures.....would like to avoid this if I can but here it is:

Code: Select all

[MeasureChild1Col]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureParent]
StringIndex=1
RegExpSubstitute=1
Substitute='</span>' : "", ';.*':"", '<span.*:' : "", "green":"1", "red" : "2"

[All_1_Calc1]
Measure=Calc
Formula=[MeasureChild1Col]
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterShowMeter AllPOS][!RainmeterHideMeter AllNEG][!RainmeterHideMeter AllNULL]
IfAboveValue=1
IfAboveAction=!Execute [!RainmeterHideMeter AllPOS][!RainmeterShowMeter AllNEG][!RainmeterHideMeter AllNULL]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterHideMeter AllPOS][!RainmeterHideMeter AllNEG][!RainmeterShowMeter AllNULL] 

[AllPOS]
MeasureName=MeasureChild1
Meter=STRING
meterStyle=stylePOS
X=196
Y=49

[AllNEG]
MeasureName=MeasureChild1
Meter=STRING
meterStyle=styleNEG
X=196
Y=49

[AllNULL]
MeasureName=MeasureChild1
Meter=STRING
meterStyle=styleRight
X=196
Y=49
Is there a way of getting rainmeter to ignore the + or - suffixes and then using the following values in a calc to change the font colour? Many thanks.
User avatar
Ahnìon
Posts: 26
Joined: December 31st, 2011, 9:34 pm
Location: Norrköping, Sweden

Re: Font Colour Variables

Post by Ahnìon »

Now, I'm pretty new here as well and I'm doing this to learn for myself to some extent -- hoping that the more experienced folks will jump in and tell me if I'm wrong ;) -- but it seems to me you could fairly easily get around the multiple-meter problem by simply setting the colour through a variable, i.e:

Code: Select all

[All_1_Calc1]
Measure=Calc
Formula=[MeasureChild1Col]
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!Execute [!SetVariable All_1_Colour "255,255,0,255"]
IfAboveValue=1
IfAboveAction=!Execute [!SetVariable All_1_Colour "255,0,0,255"]
IfBelowValue=1
IfBelowAction=!Execute [!SetVariable All_1_Colour "0,255,0,255"]

[All_1]
MeasureName=MeasureChild1
Meter=STRING
meterStyle=styleChild
colorText=#All_1_Colour#
X=196
Y=49
Generally, though, I get the notion that you could do some interesting magic by running the value through Calc with a multiple and get the tone to change gradually depending on how high or low the value is.
death is a sausage! .
mazty
Posts: 7
Joined: January 1st, 2012, 4:44 am

Re: Font Colour Variables

Post by mazty »

Thanks so much. I guess I'd spent too long staring at it and overlooked what's pretty obvious!
User avatar
Ahnìon
Posts: 26
Joined: December 31st, 2011, 9:34 pm
Location: Norrköping, Sweden

Re: Font Colour Variables

Post by Ahnìon »

Rainmeter skinning has that effect on me too, sometimes. Glad to be of use. :)
death is a sausage! .
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Font Colour Variables

Post by smurfier »

Thanks to the !SetOption bang you don't need to use variables for this. Also, you don't need to use execute if you're only using one bang.

Code: Select all

[All_1_Calc1]
Measure=Calc
Formula=[MeasureChild1Col]
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!SetOption All_1 FontColor "255,255,0,255"
IfAboveValue=1
IfAboveAction=!SetOption All_1 FontColor "255,0,0,255"
IfBelowValue=1
IfBelowAction=!SetOption All_1 FontColor "0,255,0,255"

[All_1]
MeasureName=MeasureChild1
Meter=STRING
meterStyle=styleChild
FontColor=255,255,0,255
X=196
Y=49
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
mazty
Posts: 7
Joined: January 1st, 2012, 4:44 am

Re: Font Colour Variables

Post by mazty »

Thanks very much Smurfier; the code works a treat and helps keep the script nice & tidy :thumbup: