soapyb wrote:I was thinking to use a variable somehow, but I can't find documentation on how to use a variable with a !Execute command.
Additionally...would there be a way to toggle between THREE options? Ideally, I'd like to be able to toggle between High Performance -> Balanced -> Power Saver, but I'll settle for just two if I have to.
Good idea to use a variable, this is exactly what you need.
Let's start by defining one in the [Variables] section. Let's name it Power (obviously you can use any name you'd like):
Furtherly you need a Calc measure, where you can add the IfConditions, to set the appropriate power scheme, accordingly to the value of the Power variable:
Code: Select all
[MeasurePower]
Measure=Calc
Formula=#Power#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=ADD HERE THE COMMAND TO SET THE HIGH PERFORMANCE POWER SCHEME
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=ADD HERE THE COMMAND TO SET THE HIGH BALANCED SCHEME
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=ADD HERE THE COMMAND TO SET THE POWER SAVER POWER SCHEME
DynamicVariables=1
And you need just one more action: setting the LeftMouseUpAction option of the Image meter, to change the value of the Power variable. Add the following option to the appropriate Image meter:
LeftMouseUpAction=[!Setvariable Power "((#Power#+1)%3)"][!UpdateMeasure "MeasurePower"][!UpdateMeter #CURRENTSECTION#]. This option will set the value of the Power variable from 0 to 1, from 1 to 2, then from 2 to 0 again.
Obviously with this method you can set so many schemes as many you want, just have to modify the
%3 section of the formula and add the appropriate IfConditionX / IfTrueActionX options. Eg for
%4, you can set up to 4 power schemes and so on.
About how can you set the appropriate power scheme: I think you have to set the appropriate power scheme using the PowerCfg command, which sets certain power schemes by their "identifier" (probably this isn't the best name, but I don't know how they could be named). Eg the identifier of the High Performance scheme is 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c, while the identifier of the Balanced scheme is 381b4222-f694-41f0-9685-ff5bb260df2e (you also have used them in your code). To set them , try to modify the following options of the [MeasurePower] measure (leave the not-posted options as they are):
Code: Select all
[MeasurePower]
...
IfTrueAction=[POWERCFG /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c]
...
IfTrueAction2=[POWERCFG /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e]
...
IfTrueAction3=[POWERCFG /SETACTIVE a1841308-3541-4fab-bc81-f71556f20b4a]
You have to check the last identifier, I'm not sure if I posted the right one.
Please let me know if you could handle all these. If not, please post the whole code you have so far and I'll add the needed options, to make it to work properly.