It is currently April 19th, 2024, 3:48 pm

automatic color changing on temp reading

Get help with creating, editing & fixing problems with skins
Sakujura
Posts: 5
Joined: December 24th, 2016, 3:01 pm

automatic color changing on temp reading

Post by Sakujura »

hello,

I'm kinda new to this, been looking for a problem im having. I want to auto-adjust my text of my cpu temp when its above 40degrees it should be color 1 (red) and below color 2 (green). but i think im missing something in the code. Is someone able to help me with it? this is what i have currently i tried to use the Ifcondition but it doesnt work (or i dont understand how to use it)

[MeasureCore0Temp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=0

[Temp0°C]
Meter=STRING
MeasureName=MeasureCore0Temp
X=55
Y=60
FontColor=24,254,252,255
FontSize=20
FontFace=NewMedia
StringAlign=Center
AntiAlias=1
Text=%1°C
NumOfDecimals=0

[Core0text]
Meter=String
X=15
Y=35
FontSize=20
FontFace=NewMedia
FontColor=24,254,252,255
StringAlign=Left
AntiAlias=1
Text=Core0

[Temptext]
"Meter=String
"X=10
"Y=85
"FontSize=20
"FontFace=NewMedia
"FontColor=24,254,252,255
"StringAlign=Left
"AntiAlias=1
"Text=Temp:
Last edited by Sakujura on December 24th, 2016, 4:35 pm, edited 1 time in total.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: automatic color changing on temp reading

Post by fonpaolo »

This is related to bars, but the principle is the same: https://forum.rainmeter.net/viewtopic.php?p=124176#p124176
Sakujura
Posts: 5
Joined: December 24th, 2016, 3:01 pm

Re: automatic color changing on temp reading

Post by Sakujura »

Thanks,

gonne see if i can get out of it :)
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: automatic color changing on temp reading

Post by fonpaolo »

You're welcome.

If you have problems, don't worry, ask here and someone will help you.
Sakujura
Posts: 5
Joined: December 24th, 2016, 3:01 pm

Re: automatic color changing on temp reading

Post by Sakujura »

Thx, got it finally working :)

[MeasureCore0Temp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=0
IfCondition=MeasureCore0Temp <= 25
IfTrueAction=!SetOption Temp0°C FontColor #0,0,255,255#
IfCondition2=(MeasureCore0Temp > 25) && (MeasureCore0Temp <= 28)
IfTrueAction2=!SetOption Temp0°C FontColor "0,255,0,255"
IfCondition3=(MeasureCore0Temp > 28) && (MeasureCore0Temp <= 35)
IfTrueAction3=!SetOption Temp0°C FontColor "255,255,0,255"
IfCondition4=MeasureCore0Temp > 35
IfTrueAction4=!SetOption Temp0°C FontColor "255,0,0,255"
IfConditionMode=1


[Temp0°C]
Meter=STRING
MeasureName=MeasureCore0Temp
X=55
Y=60
FontColor=[MeasureCore0Temp]
FontSize=20
FontFace=NewMedia
StringAlign=Center
AntiAlias=1
Text=%1°C
NumOfDecimals=0
DynamicVariables=1
Last edited by Sakujura on December 24th, 2016, 7:43 pm, edited 1 time in total.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: automatic color changing on temp reading

Post by fonpaolo »

You're welcome.
I'm glad you solved your problem.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: automatic color changing on temp reading

Post by balala »

Just note Sakujura, that in such cases the IfConditionMode=1 option is not needed on the [MeasureCore0Temp] measure. When the temperature range is changing, the appropriate !SetOption will be executed, and when it's not, the same !SetOption is not needed to be executed on each update cycle. I'd remove that option (IfConditionMode=1).
Also take care that the FontColor=[MeasureCore0Temp] option is not needed (and in fact it's even useless) on the [Temp0°C] meter, because its color is set by the corresponding !SetOption bangs of the [MeasureCore0Temp] measure. Remove it, as well.