It is currently February 25th, 2021, 11:00 pm

Displaying Current Power Profile

Tips and Tricks from the Rainmeter Community
kati42
Posts: 35
Joined: May 4th, 2009, 4:25 am

Displaying Current Power Profile

Post by kati42 »

For those with laptops running Vista (possibly for other Windows OS, possibly for desktops?), here's a measure for getting the current power profile for your config:

Code: Select all

[MeasurePowerScheme]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes
RegValue=ActivePowerScheme
Substitute="381b4222-f694-41f0-9685-ff5bb260df2e":"Balanced","8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c":"High Performance","a1841308-3541-4fab-bc81-f71556f20b4a":"Power Saver"
I have no idea if the values in the substitute are universal or specific to individual machines. To get the actual values, you can open up a command prompt (cmd.exe), and run powercfg -list. On my machine, the result is:

Code: Select all

C:\>powercfg -list

Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)
If you're worried about strange people you don't know telling you what to execute on your computer, here's where I got that information so you can verify it for yourself: http://technet.microsoft.com/en-us/library/cc748940.aspx

If your results differ from mine, you will need to change the Substitute line of the measure.

Once you've added this measure to your config, you can create a STRING meter to display the result. If you want to do something graphical, you might be able to substitute with numbers instead, then use Calc measures to test the values and display/hide pictures. I haven't tried that yet, though.
User avatar
dali
Posts: 1
Joined: May 2nd, 2009, 2:41 pm
Location: Tunisia

Re: Displaying Current Power Profile

Post by dali »

nice one.
i'm running vista and i got the same values.
using that command line with winXP doesn't show the registry values.
kati's skin uses this trick, and it's working fine.
thanks for sharing. ;)
kati42
Posts: 35
Joined: May 4th, 2009, 4:25 am

Re: Displaying Current Power Profile

Post by kati42 »

No problem!

Here's a minor update on how to use an image to display the profile. I use three .png files: power-scheme1.png is for Power Saver, power-scheme2.png is for Balanced, and power-scheme3.png is for High Performance:

Code: Select all

;--------------
; You may need to change the values below based on your machine
; To get the values for Vista, run powercfg.exe at a shell
; I use "power-scheme1" for "Power Saver" (icon to represent "low"), "power-scheme2" for
; Balanced (icon to represent "medium"), and "power-scheme3" for "High Performance" (icon for "high").
;--------------
[MeasurePowerScheme]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes
RegValue=ActivePowerScheme
Substitute="381b4222-f694-41f0-9685-ff5bb260df2e":"power-scheme2","8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c":"power-scheme3","a1841308-3541-4fab-bc81-f71556f20b4a":"power-scheme1"

[MeterPowerSchemeIcon]
MeasureName=MeasurePowerScheme
Meter=IMAGE
X=10
Y=10
Change the X/Y coordinates as necessary, of course. But basically all that's needed is to substitute the long key value with the name of the image (without the .png extension -- apparently Rainmeter fills that in for you).
uzuuru
Posts: 1
Joined: December 7th, 2009, 1:12 pm
Location: Austria, Europe

Re: Displaying Current Power Profile

Post by uzuuru »

Hi, you could somehow use the FriendlyName value in the Registry Key for the Value of the ActivePowerScheme...

Here is what I have tried:

Code: Select all

[MeasurePowerScheme_id]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes
RegValue=ActivePowerScheme

[MeasurePowerScheme_FriendlyName]
DynamicVariables=1
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes\[MeasurePowerScheme_id]
RegValue=FriendlyName
Does anybody of you guys know a way to actually use variables in the RegKey?

Oh, and when this succeeded, you would still have to filter the string:

Code: Select all

@%SystemRoot%\system32\powrprof.dll,-15,Balanced (recommended)
that only the information after the last comma would get through.
This way, self-defined power schemes could be displayed just like the predefined system power schemes.
jn_meter
Posts: 82
Joined: December 27th, 2016, 12:04 pm

Re: Displaying Current Power Profile

Post by jn_meter »

I thought I'd necrobump this thread because I wanted to display the current profile and, partly by using this post, but also by using this post on another forum, I got a method that works fine (on Windows 10 Pro). Here it is (well, the measures part of it).

Code: Select all

[measure_powerPlan_activeScheme]
DynamicVariables=1
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes
RegValue=ActivePowerScheme
UpdateDivider=5

[measure_powerPlan_activeScheme_name]
DynamicVariables=1
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes\[measure_powerPlan_activeScheme]
RegValue=FriendlyName
UpdateDivider=5