It is currently September 18th, 2019, 12:11 am

Variable Image for Battery

Help with creating, editing & fixing problems with skins
RGilmore
Posts: 1
Joined: August 25th, 2019, 6:14 am

Variable Image for Battery

RGilmore » August 25th, 2019, 6:22 am

I'm new here, and new to creating my own rainmeter skins, but I've got an idea for a skin that I really just can't figure out how to create. I've set my wallpaper to be 'the lick,' printed in sheet music.
To keep this quick, all you need to know is that p, mp, mf, and f are musical dynamics from softest to loudest, and I'm trying to create a battery skin that loads a different image based on the battery percentage (100-75, 74-50, 49-25, 24-0) and will also load a crescendo marking to display whether or not the battery is charging or not. I've got the images all designed and everything set, I just need to code the images in and I'm seriously seriously struggling with it. I'll post my pictures and my wallpaper if I can figure out how to do so. Any help is appreciated, thank you!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3542
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Variable Image for Battery

eclectic-tech » August 25th, 2019, 12:45 pm

You could use the PowerPlugin to do this and more.
Something like this will set the images and show/hide a crescendo meter.

Code: Select all

[MeasurePercent]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=PERCENT
IfCondition=(MeasurePercent < 25)
IfTrueAction=[!SetOption MeterImage "ImageName" "#@#Images\f.png"][!UpdateMeter *][!Redraw]
IfCondition2=(MeasurePercent >= 25) && (MeasurePercent < 50)
IfTrueAction2=[!SetOption MeterImage "ImageName" "#@#Images\mf.png"][!UpdateMeter *][!Redraw]
IfCondition3=(MeasurePercent >= 50) && (MeasurePercent < 75)
IfTrueAction3=[!SetOption MeterImage "ImageName" "#@#Images\mp.png"][!UpdateMeter *][!Redraw]
IfCondition4=(MeasurePercent >= 75)
IfTrueAction4=[!SetOption MeterImage "ImageName" "#@#Images\p.png"][!UpdateMeter *][!Redraw]

[MeasureStatus]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=STATUS
Substitute="0":"NO BATTERY","1":"CHARGING","2":"CRITICAL","3":"LOW","4":"ABOVE LOW"
IfCondition=(MeasureStatus = 1)
IfTrueAction=[!ShowMeter MeterCrescendo][!UpdateMeter *][!Redraw]
IfFalseAction=[!HideMeter MeterCrescendo][!UpdateMeter *][!Redraw]

[MeterImage]
Meter=Image
ImageName="#@#Images\f.png"

[MeterCrescendo]
Meter=Image
ImageName="#@#Images\crescendo.png"
Hidden=1