It is currently March 29th, 2024, 11:36 am

Toggle between Power Options and variable meter image

Get help with creating, editing & fixing problems with skins
soapyb
Posts: 5
Joined: December 3rd, 2017, 6:35 am

Re: Toggle between Power Options and variable meter image

Post by soapyb »

Hahaha well before posting here I was crawling through old posts and your name kept popping up to resolve issues for people. Let's just say you're a very helpful guy, it's much appreciated
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Toggle between Power Options and variable meter image

Post by balala »

Thanks for the appreciations.
nikko
Posts: 44
Joined: December 5th, 2017, 5:58 pm

Re: Toggle between Power Options and variable meter image

Post by nikko »

hello. how to make this working with separated buttons that every buttons has his own function?
example,
O - Power save,
O - Balanced,
O - High
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Toggle between Power Options and variable meter image

Post by balala »

nikko wrote:hello. how to make this working with separated buttons that every buttons has his own function?
Create three Button meters, one for each power scheme. Use the appropriate options for each of them, as you want (ButtonImage, X, Y and so on - I don't post these, just the essence, the appropriate ButtonCommand options). Use the following ButtonCommand options for them:

Code: Select all

[MeterPowerSave]
Meter=Button
...
ButtonCommand=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"][!CommandMeasure "MeasureRun" "Run"]

[MeterBalanced]
Meter=Button
...
ButtonCommand=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e"][!CommandMeasure "MeasureRun" "Run"]

[MeterHigh]
Meter=Button
...
ButtonCommand=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE a1841308-3541-4fab-bc81-f71556f20b4a"][!CommandMeasure "MeasureRun" "Run"]
nikko
Posts: 44
Joined: December 5th, 2017, 5:58 pm

Re: Toggle between Power Options and variable meter image

Post by nikko »

this not working well:

Code: Select all

[Variables]
high=High
balance=Balanced
saver=saver
Power=0

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
State=Hide

[MeasureActivePower]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes
RegValue=ActivePowerScheme
Substitute="8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c":"#high#","381b4222-f694-41f0-9685-ff5bb260df2e":"#balance#","a1841308-3541-4fab-bc81-f71556f20b4a":"#saver#"
DynamicVariables=1

[MeasurePower]
Measure=Calc
Formula=#Power#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"][!CommandMeasure "MeasureRun" "Run"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e"][!CommandMeasure "MeasureRun" "Run"]
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE a1841308-3541-4fab-bc81-f71556f20b4a"][!CommandMeasure "MeasureRun" "Run"]
DynamicVariables=1


[MeterPowerSave]
Meter=String
MeasureName=MeasureActivePower
StringAlign=Center
FontColor=211,0,255
X=88
Y=30
Text=#saver#
LeftMouseUpAction=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"][!CommandMeasure "MeasureRun" "Run"]

[MeterBalanced]
Meter=String
MeasureName=MeasureActivePower
StringAlign=Center
FontColor=255,0,0
X=88
Y=50
Text=#balance#
LeftMouseUpAction=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e"][!CommandMeasure "MeasureRun" "Run"]

[MeterHigh]
Meter=String
MeasureName=MeasureActivePower
StringAlign=Center
FontColor=0,111,0
X=88
Y=70
Text=#high#
LeftMouseUpAction=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE a1841308-3541-4fab-bc81-f71556f20b4a"][!CommandMeasure "MeasureRun" "Run"]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Toggle between Power Options and variable meter image

Post by balala »

nikko wrote:this not working well:
Yeah, probably my fault, sorry. Here is a fix:

Code: Select all

[Variables]
high=High
balance=Balanced
saver=saver
Power=0

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
State=Hide

[MeasureActivePower]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Power\User\PowerSchemes
RegValue=ActivePowerScheme
Substitute="8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c":"#high#","381b4222-f694-41f0-9685-ff5bb260df2e":"#balance#","a1841308-3541-4fab-bc81-f71556f20b4a":"#saver#"
DynamicVariables=1

[MeasurePower]
Measure=Calc
Formula=#Power#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"][!CommandMeasure "MeasureRun" "Run"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e"][!CommandMeasure "MeasureRun" "Run"]
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE a1841308-3541-4fab-bc81-f71556f20b4a"][!CommandMeasure "MeasureRun" "Run"]
DynamicVariables=1

[MeterPowerSave]
Meter=String
MeasureName=MeasureActivePower
StringAlign=Center
FontColor=211,0,255
SolidColor=0,0,0,1
X=88
Y=30
Text=#saver#
LeftMouseUpAction=[!SetVariable Power "2"][!UpdateMeasure "MeasurePower"]

[MeterBalanced]
Meter=String
MeasureName=MeasureActivePower
StringAlign=Center
FontColor=255,0,0
SolidColor=0,0,0,1
X=88
Y=50
Text=#balance#
LeftMouseUpAction=[!SetVariable Power "1"][!UpdateMeasure "MeasurePower"]

[MeterHigh]
Meter=String
MeasureName=MeasureActivePower
StringAlign=Center
FontColor=0,111,0
SolidColor=0,0,0,1
X=88
Y=70
Text=#high#
LeftMouseUpAction=[!SetVariable Power "0"][!UpdateMeasure "MeasurePower"]
With the buttons (or strings in this case), we should have to set values for the Power variable. Then, the [MeasurePower] measure, through the [MeasureRun] measure, sets the appropriate power scheme.
Sorry for the confusion.

Just as a side note, I mention I've added a SolidColor=0,0,0,1 option, to each of the [MeterPowerSave], [MeterBalanced] and [MeterHigh] meters. With these options will be much easier to click the meters.
nikko
Posts: 44
Joined: December 5th, 2017, 5:58 pm

Re: Toggle between Power Options and variable meter image

Post by nikko »

sorry, all clicks are 1 step late. After next click previous activate.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Toggle between Power Options and variable meter image

Post by balala »

nikko wrote:sorry, all clicks are 1 step late. After next click previous activate.
Yeah, you're right, they indeed are.
To fix this, when the parameter option is set on the [MeasureRun] measure by the !SetOption bangs of the IfTrueActionX options of the [MeasurePower] measure, the [MeasureRun] measure should immediately updated. So, add an [!UpdateMeasure "MeasureRun"] bang after each !SetOption bang of the mentioned options:

Code: Select all

[MeasurePower]
...
IfTrueAction=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"][!UpdateMeasure "MeasureRun"][!CommandMeasure "MeasureRun" "Run"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e"][!UpdateMeasure "MeasureRun"][!CommandMeasure "MeasureRun" "Run"]
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=[!SetOption MeasureRun Parameter "POWERCFG /SETACTIVE a1841308-3541-4fab-bc81-f71556f20b4a"][!UpdateMeasure "MeasureRun"][!CommandMeasure "MeasureRun" "Run"]
Sorry for my inattention.