It is currently May 2nd, 2024, 4:17 am

[Help] Trying to make a battery meter

Get help with creating, editing & fixing problems with skins
ccm29
Posts: 3
Joined: June 8th, 2012, 12:36 am

[Help] Trying to make a battery meter

Post by ccm29 »

So any suggestions are welcome, I'm trying to make a battery life indicator, but I don't have any ideas as to how to get Rainmeter to actually read the battery.
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: [Help] Trying to make a battery meter

Post by Seahorse »

You will need to use the Power plugin, although by the sound of it you might be better off working through Rainmeter 101 first...

He is the code for my own for when you have read through the above.

Code: Select all

[Rainmeter]
Author=Seahorse (AKA Osric Wuscfrea) mr.seahorse@gmail.com
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
Blur=1
BlurRegion=2,0,0,210,55,25

[Metadata]
Name=Cobalt Battery Meter
Version=1.1
License=Creative Commons BY-NC-SA 3.0
Information=Description: Laptop Battery Meter. | Instructions: Hover mouse for additional information. | Credits: Nil.

;1.1 Revised bars and reduced skin height
;1.0 Base version

;===============================================================================================
;Variables
;===============================================================================================

[Variables]

;Fonts & Colours
@include="#SKINSPATH#Cobolt\Settings.inc"

;===============================================================================================
;Measures
;===============================================================================================

[MeasureBatteryPercent]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=PERCENT
MinValue=0
MaxValue=100

[MeasureBatteryACLine]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=ACLINE
Substitute="0":"Battery","1":"Mains"

[MeasureBatteryStatus]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=STATUS
Substitute="0":"Battery","1":"Charging","2":"Critical","3":"Low","4":"High"

[CalcBatteryTint]
Measure=Calc
Formula=MeasureBatteryPercent<20 ? -1 : -2
Substitute="-1":"#Colour6#","-2":"#Colour1#"

;===============================================================================================
;Meters
;===============================================================================================

[MeterBatteryLabel]
Meter=String
X=10
Y=10
MeterStyle=StringStyleNoClip
FontColor=#Colour2#
Text="Battery"

[MeterBatteryString]
Meter=STRING
MeasureName=MeasureBatteryStatus
X=R
Y=r
MeterStyle=StringStyleNoClip
Text=%1

[MeterBarBackground]
Meter=Image
X=10
Y=20r
W=191
H=14
ImageName=#ROOTCONFIGPATH#\Images\BarBG.png

[MeterBatteryBar]
Meter=Bar
MeasureName=MeasureBatteryPercent
BarOrientation=Horizontal
X=r
Y=r
W=191
H=14
Flip=0
ImageTint=[CalcBatteryTint]
BarImage=#ROOTCONFIGPATH#\Images\Bar.png
DynamicVariables=1

[MeterBattery%String]
Meter=STRING
Measurename=MeasureBatteryPercent
X=105
Y=2r
MeterStyle=StringStyleCenter
Text=%1%

;-----------------------------------------------------------------------------------------------
;Graphics
;-----------------------------------------------------------------------------------------------

;Size forces the aero blur borders to correct position.
[MeterGlossTop]
Meter=Image
X=0
Y=0
W=210
H=40
ImageName=#ROOTCONFIGPATH#Images/GlossTop.png
ToolTipText=Available Charge: [MeasureBatteryPercent]%#CRLF#Power Source: [MeasureBatteryACLine]#CRLF#Battery Status: [MeasureBatteryStatus]
ToolTipType=1
ToolTipTitle=Power Details: 
ToolTipIcon=INFO
DynamicVariables=1

[MeterGlossBottom]
Meter=Image
X=0
Y=30
W=210
H=25
ImageName=#ROOTCONFIGPATH#Images/GlossBottom.png
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt