It is currently May 5th, 2024, 6:38 pm
Get help with creating, editing & fixing problems with skins
cwfrizzell
Posts: 77 Joined: August 10th, 2009, 9:03 pm
Post
by cwfrizzell » April 3rd, 2011, 4:01 pm
I'm building a battery meter that will change the image based on the battery's status:
Code: Select all
[Rainmeter]
Update=1000
;====================================================================VARIABLES==
[Variables]
Color1=255, 255, 255, 217
Color2=255, 255, 255, 160
FontName=Trebuchet MS
FontHeight1=10
FontHeight2=7
FontHeight3=12
AntiAlias=1
;=====================================================================MEASURES==
[MeasurePercent]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=PERCENT
;UpdateDivider=10
[MeasureBattery]
Measure=Calc
Formula=[MeasurePercent] < 25 ? 1 : ((([MeasurePercent] > 25) && ([MeasurePercent] < 50)) ? 2 : ((([MeasurePercent] > 50)) && ([MeasurePercent] < 75)) ? 3 : ((([MeasurePercent] > 75) && ([MeasurePercent] < 100)) ? 4 : 5)))
Substitute="1":"Battery_1.png","2":"Battery_3.png","3":"Battery_5.png","4":"Battery_7.png","5":"Battery_Power.png"
DynamicVariables=1
;=======================================================================METERS==
[DisplayBattery]
Meter=IMAGE
ImageName=[MeasureBattery]
Path="#SKINSPATH#\My All In One\Resources"
X=0
Y=4
H=35
W=35
;LeftMouseDownAction= !Execute [RunDll32.exe shell32.dll,Control_RunDLL powercfg.cpl]
ToolTipTitle="Power"
ToolTipText="Battery: [MeasurePercent]%"
Hidden=0
DynamicVariables=1
[MeterPercent]
Meter=STRING
MeasureName=MeasurePercent
X=37r
Y=12
H=15
W=50
FontColor=#Color1#
FontFace=#FontName#
FontSize=#FontHeight1#
StringAlign=LEFT
StringEffect=SHADOW
StringStyle=NORMAL
AntiAlias=1
Text="%1"
Percentual=1
Postfix="% "
AutoScale=1
Unfortunately, the code doesn't work. I've scoured the forums for help and examples with no luck. Any ideas?
Cheers!
Chuck
jsmorley
Developer
Posts: 22631 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » April 3rd, 2011, 4:07 pm
What is the measure [MeasureBattery] returning when you look at it in "About"?
cwfrizzell
Posts: 77 Joined: August 10th, 2009, 9:03 pm
Post
by cwfrizzell » April 3rd, 2011, 4:11 pm
jsmorley wrote: What is the measure [MeasureBattery] returning when you look at it in "About"?
ERROR: Unable to open Image... 0.png
Cheers!
Chuck
jsmorley
Developer
Posts: 22631 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » April 3rd, 2011, 4:17 pm
Not looking at the "Log", but looking at the skin itself in "About". The value of the measure [MeasureBattery] is returning "0" then I take it?
jsmorley
Developer
Posts: 22631 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » April 3rd, 2011, 4:23 pm
I have skin that does this, and works really well. Try it like this, not using "dynamic" values in the Calc measures using substitute to convert from a number to a string, but using DynamicVariables on the meter displaying it.
[MeasureNowWeatherTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureYahooWeather]
StringIndex=36
[MeasureTempDesc]
Measure=Calc
Formula=MeasureNowWeatherTemp <= 33 ? 1 : (((MeasureNowWeatherTemp > 33) && (MeasureNowWeatherTemp < 50)) ? 2 : (((MeasureNowWeatherTemp >= 50) && (MeasureNowWeatherTemp < 60)) ? 3 : (((MeasureNowWeatherTemp >= 60) && (MeasureNowWeatherTemp < 80)) ? 4 : (((MeasureNowWeatherTemp >= 80) && (MeasureNowWeatherTemp < 90)) ? 5 : ((MeasureNowWeatherTemp >= 90 ? 6 : 7))))))
Substitute=".00000":"","1":"really cold","2":"sorta chilly","3":"fairly cool","4":"fairly warm","5":"sorta hot","6":"really hot"
cwfrizzell
Posts: 77 Joined: August 10th, 2009, 9:03 pm
Post
by cwfrizzell » April 3rd, 2011, 4:29 pm
jsmorley wrote: Not looking at the "Log", but looking at the skin itself in "About". The value of the measure [MeasureBattery] is returning "0" then I take it?
Yes, it's 0
Cheers!
Chuck
jsmorley
Developer
Posts: 22631 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » April 3rd, 2011, 4:41 pm
So if the measure is returning "0" (About ignores the Substitute) then unless your battery is in fact completely dead, it isn't liking the construct of your Formula= part of the Calc measure. I find you have to buy parentheses by the bakers dozen when you do these big conditionals. Be sure that you have the formula properly delimited to create the right conditional execution.
cwfrizzell
Posts: 77 Joined: August 10th, 2009, 9:03 pm
Post
by cwfrizzell » April 3rd, 2011, 4:57 pm
jsmorley wrote: I have skin that does this, and works really well. Try it like this, not using "dynamic" values in the Calc measures using substitute to convert from a number to a string, but using DynamicVariables on the meter displaying it.
[MeasureNowWeatherTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureYahooWeather]
StringIndex=36
[MeasureTempDesc]
Measure=Calc
Formula=MeasureNowWeatherTemp <= 33 ? 1 : (((MeasureNowWeatherTemp > 33) && (MeasureNowWeatherTemp < 50)) ? 2 : (((MeasureNowWeatherTemp >= 50) && (MeasureNowWeatherTemp < 60)) ? 3 : (((MeasureNowWeatherTemp >= 60) && (MeasureNowWeatherTemp < 80)) ? 4 : (((MeasureNowWeatherTemp >= 80) && (MeasureNowWeatherTemp < 90)) ? 5 : ((MeasureNowWeatherTemp >= 90 ? 6 : 7))))))
Substitute=".00000":"","1":"really cold","2":"sorta chilly","3":"fairly cool","4":"fairly warm","5":"sorta hot","6":"really hot"
I had no idea about the "About" box until you mentioned it. Dang brackets... It works now. Learned two things on this... Thanks!
Thanks!
Last edited by cwfrizzell on April 3rd, 2011, 4:59 pm, edited 1 time in total.
Cheers!
Chuck
jsmorley
Developer
Posts: 22631 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » April 3rd, 2011, 4:59 pm
Outstanding...