I see the issue. RunCommand is designed to return both a string value (the output of the command to Standard Out) and a number value (the errorlevel of the command execution). If you use the number value of any command that succeeds, it will always be "1".
So the issue is here:
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=powershell -NoLogo #@#Scripts\passwordExpires.ps1
State=Hide
OutputType=ANSI
IfAboveValue=5
IfAboveAction=[!SetOption MeterResult FontColor 255,0,0,255]
IfBelowValue=6
IfBelowAction=[!SetOption MeterResult FontColor 0,255,0,255]
What is going on is that the IfActon options are by design always going to use the "number" value of the measure they are attached to. In this case, that will always be "1".
So the long and the short of it is that you were on to it all the time balala...
If you use IfCondition instead, where you have more control over what is evaluated, you can ask it to test the "string" value of the measure and treat it as a "number", rather than using the actual "number" value, which will again always be "1" if the command succeeds.
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=powershell -NoLogo #@#Scripts\passwordExpires.ps1
State=Hide
OutputType=ANSI
IfCondition=[MeasureRun] < 6
IfTrueAction=[!SetOption MeterResult FontColor "247,234,82,255"]
IfFalseAction=[!SetOption MeterResult FontColor "82,247,109,255"]
DynamicVariables=1
That will work...
https://docs.rainmeter.net/manual-beta/plugins/runcommand/
The string value of the measure
The string value of the measure will be any output that the program writes to STDOUT. In effect, what you would see if you manually ran the command in a cmd.exe Command Prompt window will become the string value of the measure.
The number value of the measure
The number value of the measure will indicate if the command finished with or without any errors. You can get the number value of the measure by using Section Variables (e.g. [MeasureName:]). Before the command has first run, the number value of the measure will be -1. While the command is running, the number value of the measure will be 0. If an error occurs, the number value of the measure will indicate the type of error that has occurred. If the program finishes without error, the number value of the measure will be 1, meaning "success". These can be used to take different skin actions depending on the numeric return value.