It is currently April 24th, 2024, 7:10 am

Help with CPU Temp Bar

Get help with creating, editing & fixing problems with skins
Deofol
Posts: 19
Joined: February 19th, 2020, 6:29 am

Help with CPU Temp Bar

Post by Deofol »

Hey there, I've been using rainmeter for a while and I always end up finding skins that I like, missing features from some other skins that I don't like as much, so I've ended up editing skins on my own and usually can handle it by doing research. However, after investigating this issue, I've only found solutions for other people's issues which for some reason won't work for me. Here's my problem, I've got a skin that measures my CPU temp and I'd like it to change colors depending on my CPU's temperature range. Here's the code:

Code: Select all

[MeasureMaxTemp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=MaxTemperature
MinValue=30
MaxValue=72
IfCondition=MeasureMaxTemp<=40
IfTrueAction=!SetOption TempMeterBar BarColor 0,0,255,255
IfCondition2=(MeasureMaxTempColor>40) && (MeasureMaxTempColor<=46)
IfTrueAction2=!SetOption TempMeterBar BarColor 0,255,255,255
IfCondition3=(MeasureMaxTempColor>46) && (MeasureMaxTempColor<=60)
IfTrueAction3=!SetOption TempMeterBar BarColor 0,255,0,255
IfCondition4=(MeasureMaxTempColor>60) && (MeasureMaxTempColor<=71)
IfTrueAction4=!SetOption TempMeterBar BarColor 255,255,0,255
IfCondition5=MeasureMaxTempColor>71
IfTrueAction5=!SetOption TempMeterBar BarColor 255,0,0,255
OnUpdateAction=[!UpdateMeter TempMeterBar][!Redraw]

[TempMeterBar]
Meter=Bar
MeasureName=MeasureMaxTemp
BarOrientation=Horizontal
Flip=0
BarColor=[MeasureMaxTemp]
X=10
Y=30
W=180
H=5
DynamicVariables=1

[TempBarLine]
Meter=IMAGE
X=10
Y=30
W=180
H=5
SolidColor=255,255,255,50
Values I took for my processor from here: http://www.buildcomputers.net/cpu-temperature.html

The thing is, the color only stays blue when it registers temperature measure <=40. If it's anywhere over that initially, it stays white until it drops to fulfill that condition. If it's under that, it just stays blue. Won't change color at all after it turns blue. Any idea what might be happening?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help with CPU Temp Bar

Post by mak_kawa »

See the Rainmeter log. Section name "MeasureMaxTempColor" is not present. Modify it to "MeasureMaxTemp".
And probably, bang must be enclosed with brackets like [!SetOption TempMeterBar BarColor 0,0,255,255]
Deofol
Posts: 19
Joined: February 19th, 2020, 6:29 am

Re: Help with CPU Temp Bar

Post by Deofol »

mak_kawa wrote: February 19th, 2020, 7:28 am See the Rainmeter log. Section name "MeasureMaxTempColor" is not present. Modify it to "MeasureMaxTemp".
And probably, bang must be enclosed with brackets like [!SetOption TempMeterBar BarColor 0,0,255,255]
You're right about that. I had already tried like that too, though and wasn't working correctly :/

As I said, I had been trying several methods to fix it up heh.

For some reason, I just got it working now after trying what you said and removing parenthesis I had added to the colors. Thanks a ton!
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with CPU Temp Bar

Post by balala »

mak_kawa wrote: February 19th, 2020, 7:28 am See the Rainmeter log. Section name "MeasureMaxTempColor" is not present. Modify it to "MeasureMaxTemp".
That's why it is always a better idea to use the #CURRENTSECTION# variable instead of naming exactly the measure. For instance the above IfCondition might be: IfCondition=#CURRENTSECTION#<=40 or IfCondition2: IfCondition2=(#CURRENTSECTION#>40) && (#CURRENTSECTION#<=46). Note that this works ONLY if the condition is set into the same measure. If you want to set such a condition into another measure, you have to use the name of the measure explicitly.
mak_kawa wrote: February 19th, 2020, 7:28 am And probably, bang must be enclosed with brackets like [!SetOption TempMeterBar BarColor 0,0,255,255]
Although this always is an excelent idea, it's not mandatory. If only one single bang is used, it works even with no brackets. IfTrueAction=!SetOption TempMeterBar BarColor 0,0,255,255 is same well as IfTrueAction=[!SetOption TempMeterBar BarColor 0,0,255,255].
However as said just to form better habits, which in future might be useful, using the brackets is indeed a good idea (same way as enclosing the values set through bangs into quotes).
Deofol
Posts: 19
Joined: February 19th, 2020, 6:29 am

Re: Help with CPU Temp Bar

Post by Deofol »

balala wrote: February 19th, 2020, 2:09 pm That's why it is always a better idea to use the #CURRENTSECTION# variable instead of naming exactly the measure. For instance the above IfCondition might be: IfCondition=#CURRENTSECTION#<=40 or IfCondition2: IfCondition2=(#CURRENTSECTION#>40) && (#CURRENTSECTION#<=46). Note that this works ONLY if the condition is set into the same measure. If you want to set such a condition into another measure, you have to use the name of the measure explicitly.

Although this always is an excelent idea, it's not mandatory. If only one single bang is used, it works even with no brackets. IfTrueAction=!SetOption TempMeterBar BarColor 0,0,255,255 is same well as IfTrueAction=[!SetOption TempMeterBar BarColor 0,0,255,255].
However as said just to form better habits, which in future might be useful, using the brackets is indeed a good idea (same way as enclosing the values set through bangs into quotes).
Good to know, thanks! I'll replace that keyword in my code :)
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with CPU Temp Bar

Post by balala »

Deofol wrote: February 19th, 2020, 2:46 pm I'll replace that keyword in my code :)
Yep, replacing it avoids the possibility to make such mistakes.