It is currently May 6th, 2024, 11:22 am

Color changing Temperature Meter

Get help with creating, editing & fixing problems with skins
alinwrkshp
Posts: 2
Joined: September 28th, 2011, 1:13 am

Color changing Temperature Meter

Post by alinwrkshp »

Hello all,

I have used Rainmeter for quite a while, but I am struggling with a calc measure. I am trying to get the text of my GPU temp meter to change color depending on a few ranges...

<60 = Green
60-70 = Yellow
70+ = Red

I am messing around with some code I found in the forums but I am still getting errors (Calc: #Internal error! in measure [MeasureColorGPU].)

Code: Select all

[Variables]
@include=#SKINSPATH#Circle Meter\Variables.txt
White=255,255,255,255
Yellow=255,215,0,255
Green=34,139,34,255
Red=178,34,34,255
MyColor=#White#

;

[MeasureGPU]
Measure=Plugin
Plugin=Plugins\OpenHardwareMonitorPlugin.dll
Hardware=AMD Radeon HD 6900 Series
Type=Temperatures
Sensor=GPU Core
MaxValue=85

[MeasureColorGPU]
Measure=Calc
Formula=(MeasureGPU <= 60 ? -1 : ((MeasureGPU > 60) && (MeasureGPU < 71) ? -2 : ((MeasureGPU >= 71) ? -3)))
Substitute="-1":"#Green#","-2":"#Yellow#","-3":"#Red#"


;IfAboveValue=50
;IfAboveAction=!SetOption "GPUsageText" "FontColor" #Red#
;IfAboveAction=!SetOption "GPU" "FontColor" #Red#

[MeterProgress]
Meter=ROUNDLINE
MeasureName=MeasureGPU
X=54
Y=54
LineWidth=7.0
LineLength=46
LineStart=37
StartAngle=6.29
RotationAngle=6.29
AntiAlias=1
LineColor=255, 255, 255
Solid=1

[Overlay]
Meter=IMAGE
ImageName=#IMGL#
X=0
Y=0

[GPU]
Meter=string
MeterStyle=Style3
FontSize=17
FontColor=[MeasureColorGPU]
X=54
Y=33
Text="GPU"

[GPUsageText]
MeasureName=MeasureGPU
Meter=STRING
MeterStyle=Style3
FontSize=12
FontColor=[MeasureColorGPU]
Text="%1°C"
X=r
Y=22r
I know my error is in the formula of the measure calc, but I am not quite sure what's wrong with it. Are my paren's off?

Any help would be great! :D
Justin
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Color changing Temperature Meter

Post by Kaelri »

You don't have an "else" result for the last conditional:

Code: Select all

Formula=MeasureGPU <= 60 ? -1 : ((MeasureGPU > 60) && (MeasureGPU < 71) ? -2 : ((MeasureGPU >= 71) ? -3 : -4))
On the other hand, since there are only three conditions, you don't really need it:

Code: Select all

Formula=MeasureGPU <= 60 ? -1 : (MeasureGPU <= 70 ? -2 : -3)
:)
alinwrkshp
Posts: 2
Joined: September 28th, 2011, 1:13 am

Re: Color changing Temperature Meter

Post by alinwrkshp »

ah...now that makes perfect sense!! :oops:

Guess, I just needed to see it. Thanks a ton, still needed to add the DynamicVariables flag, but works like a charm!

thx again!
Justin