It is currently April 27th, 2024, 10:28 am

RunCommand

Share and get help with Plugins and Addons
DeART.69
Posts: 7
Joined: January 6th, 2015, 2:37 pm

Re: RunCommand 1.0

Post by DeART.69 »

My code, but [measureValue] always is "1":
[Variables]
minVoltage=3100

[measureTimer]
Measure=Calc
Formula=1
UpdateDivider=#upSecond#
OnUpdateAction=[!CommandMeasure measureVoltage Run]
IfConditionMode=1
IfCondition=(measurePower = 0) && (measureValue = 1)
IfTrueAction=[Play #@#U.wav]

[measureVoltage]
Measure=Plugin
Plugin=RunCommand.dll
Parameter="wmic Path Win32_Battery Get DesignVoltage"
Substitute="DesignVoltage":"","#CRLF#":""," ":""
DynamicVariables=1
OutputType=ANSI

[measurePower]
Measure=Plugin
Plugin=PowerPlugin.dll
PowerState=ACLINE

[measureValue]
Measure=Calc
Formula=measureVoltage < #minVoltage# ? 1 : 0
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: RunCommand 1.0

Post by fonpaolo »

Correct me if I'm wrong, but [measureVoltage] output is in a string format.
If the measure doesn't have a numeric part (some measures can give both numeric values and text strings), the numeric value is always 0.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RunCommand 1.0

Post by jsmorley »

fonpaolo wrote:Correct me if I'm wrong, but [measureVoltage] output is in a string format.
If the measure doesn't have a numeric part (some measures can give both numeric values and text strings), the numeric value is always 0.
At least in wmic, I think that should be a 64bit integer. So I think both the string and number values of the measure should work.
DeART.69
Posts: 7
Joined: January 6th, 2015, 2:37 pm

Re: RunCommand 1.0

Post by DeART.69 »

jsmorley wrote: At least in wmic, I think that should be a 64bit integer. So I think both the string and number values of the measure should work.
I can point to a numeric type?
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand 1.0

Post by Brian »

fonpaolo wrote:Correct me if I'm wrong, but [measureVoltage] output is in a string format.
If the measure doesn't have a numeric part (some measures can give both numeric values and text strings), the numeric value is always 0.
Almost. Before the command is run, the numeric value of the measure will be -1. While running the command, the numeric value will be 0. If the command finished successfully, then the numeric value will be 1 (not 0). This was done to somehow get a sense of any error messages that come along from time to time, and also because most output is a string.

Normally in Rainmeter, if the result of a measure is a number, then the numeric value of a measure is that said number, but not with RunCommand (it will be -1, 0, 1, or an error code).



@DeArt.69:
You removed the brackets [] from your original post, just add them back.

Something like this:

Code: Select all

[measureVoltage]
Measure=Plugin
Plugin=RunCommand
Parameter="wmic Path Win32_Battery Get DesignVoltage"
Substitute="DesignVoltage":"","#CRLF#":""," ":""
OutputType=ANSI

[measureValue]
Measure=Calc
Formula=[measureVoltage] < #minVoltage# ? 1 : 0
DynamicVariables=1
-Brian
DeART.69
Posts: 7
Joined: January 6th, 2015, 2:37 pm

Re: RunCommand 1.0

Post by DeART.69 »

Brian wrote:
You do not have the required permissions to view the files attached to this post.
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand 1.0

Post by Brian »

I can't figure out why your [measureValue] is returning 1 instead of 0. The fact that "4195 < 3100" is false, means the Calc should return 0. :confused:


The error message in the log happens on the first update because the plugin hasn't finished before the Calc is trying to use its value. You can get rid of that error with a FinishAction on [measureVoltage].

Code: Select all

[measureVoltage]
Measure=Plugin
Plugin=RunCommand
Parameter="wmic Path Win32_Battery Get DesignVoltage"
Substitute="DesignVoltage":"","#CRLF#":""," ":""
OutputType=ANSI
FinishAction=[!EnableMeasure measureValue]

[measureValue]
Measure=Calc
Formula=[measureVoltage] < #minVoltage# ? 1 : 0
DynamicVariables=1
Disabled=1
RunCommand seems to be getting the correct number.
I personally don't have a laptop to test with at the moment, but jsmorley made a quick little AutoIt program that outputs just like wmic command, and with that I am getting the correct results.

-Brian
DeART.69
Posts: 7
Joined: January 6th, 2015, 2:37 pm

Re: RunCommand 1.0

Post by DeART.69 »

Brian wrote: The error message in the log happens on the first update because the plugin hasn't finished before the Calc is trying to use its value. You can get rid of that error with a FinishAction on [measureVoltage].

Code: Select all

[measureVoltage]
Measure=Plugin
Plugin=RunCommand
Parameter="wmic Path Win32_Battery Get DesignVoltage"
Substitute="DesignVoltage":"","#CRLF#":""," ":""
OutputType=ANSI
FinishAction=[!EnableMeasure measureValue]

[measureValue]
Measure=Calc
Formula=[measureVoltage] < #minVoltage# ? 1 : 0
DynamicVariables=1
Disabled=1
RunCommand seems to be getting the correct number.
I personally don't have a laptop to test with at the moment, but jsmorley made a quick little AutoIt program that outputs just like wmic command, and with that I am getting the correct results.

-Brian
Thank you, Friend! It work correct!
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand 1.0

Post by Brian »

DeART.69 wrote:Thank you, Friend! It work correct!
Awesome! Glad it works for you! :D

-Brian
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: RunCommand 1.0

Post by fonpaolo »

I have one question I think it's related to the plugin, some users of my suite have reported an error:
Unable to load RunCommand (error 126).
I suggested to them to install your skin, this has only partially solved the problem, now the error message is:
!CommandMeasure: Not Supported.

I'm currently using my suite with the same OS and I also tested it with other OS and I haven't encountered any problem.

Since the people reporting this problem are only a few, I was thinking of an incorrect installation of Rainmeter or some UAC issues, maybe related to administrative rights...

Any advice?