Loop measure


Measure=Loop Creates a looping counter between two values.

The measure will be the value of StartValue for one update, will increment based on the value of Increment on each subsequent update, and will be the value of EndValue for one update. If LoopCount is other than 1, the loop will then repeat.

On each loop, if the value of Increment is such that the final increment would cause the value to overrun the value of EndValue, the final increment will be reduced to the remainder required to have the loop end at EndValue.

The measure will have a range that is the difference between StartValue and EndValue for use by meters requiring a percentage. There cannot be a negative percentage, so the range will always be lowest value to highest value.

Any dynamic change to any of the four measure options, or dynamically changing InvertMeasure on the measure, will cause the loop to be reset and start over with the new values.

Note: All options must be positive or negative whole numbers, or formulas that resolve to whole numbers. Fractional values will be truncated.

Options

General measure options
All general measure options except AverageSize are valid. MinValue and MaxValue are automatically set based on StartValue and EndValue, and may not be manually set or changed.
StartValue Default: 1

The starting value for the loop. This may be any positive or negative whole number.

EndValue Default: 100

The ending value for the loop. This may be any positive or negative whole number.

Increment Default: 1

A positive or negative whole number by which the counter will be incremented on each update.

LoopCount Default: 0

The number of times the loop will be executed. The default of 0 will endlessly repeat. When LoopCount is reached, the measure will stop at and maintain the value of the EndValue option.

Measure Commands

Commands that can be sent to a Loop measure using the !CommandMeasure bang.

Reset

This will cause the measure to reset the loop and restart using the current values for all options.

Example: [!CommandMeasure MeasureName "Reset"]

Note: Any dynamic change to any of the four measure options, or dynamically changing InvertMeasure on the measure, will automatically perform a reset of the loop. This command would not be required.

Examples

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureLoop1]
Measure=Loop
StartValue=37
EndValue=59
Increment=1
LoopCount=0

[MeasureLoop2]
Measure=Loop
StartValue=10
EndValue=0
Increment=-1
LoopCount=1

[MeterLoop1]
Meter=String
MeasureName=MeasureLoop1
W=154
H=50
X=77
StringAlign=Center
FontSize=35
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
LeftMouseUpAction=[!TogglePauseMeasure MeasureLoop1]
MiddleMouseUpAction=[!CommandMeasure MeasureLoop1 "Reset"]

[MeterLoop2]
Meter=String
MeasureName=MeasureLoop2
W=154
H=50
X=77
Y=10R
StringAlign=Center
FontSize=35
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
LeftMouseUpAction=[!TogglePauseMeasure MeasureLoop2]
MiddleMouseUpAction=[!CommandMeasure MeasureLoop2 "Reset"]

If InvertMeasure is set to 1, the opposite of the value generated by the loop will be returned. This can have the effect of reversing the direction of the loop. Toggling InvertMeasure with !SetOption can create a "ping-pong" effect with the measure.

[Rainmeter]
Update=500
DynamicWindowSize=1
AccurateText=1

[Variables]
Start=0
End=10
Incr=1

[MeasureLoop]
Measure=Loop
StartValue=#Start#
EndValue=#End#
Increment=#Incr#
LoopCount=1

[MeasurePingPong]
Measure=Calc
IfCondition=MeasureLoop = #End#
IfTrueAction=[!SetOption MeasureLoop InvertMeasure 1][!UpdateMeasure MeasureLoop]
IfCondition2=MeasureLoop = #Start#
IfTrueAction2=[!SetOption MeasureLoop InvertMeasure 0][!UpdateMeasure MeasureLoop]

[MeterLoop]
Meter=String
MeasureName=MeasureLoop
W=154
H=50
X=77
StringAlign=Center
FontSize=35
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1