It is currently March 28th, 2024, 3:41 pm

[Suggestion] Shape/Extend-Modifier and path: Measures and expressions

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

[Suggestion] Shape/Extend-Modifier and path: Measures and expressions

Post by ikarus1969 »

Hi!

I want to suggest that extend-modifiers of shape-meters should extend to not only being static strings but should have the possibility to be measures (the string-values) and/or simple expressions that results in strings.

So they can automatically adapt to certain rules the measures/expressions are calculating.

If i want to change more than one Attribute-Modifiers and/or Transform-Modifiers at once this possibility would be handy.

What do you think?


Edit: the same for the Path
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Suggestion] Shape/Extend-Modifier and path: Measures and expressions

Post by balala »

ikarus1969 wrote:I want to suggest that extend-modifiers of shape-meters should extend to not only being static strings but should have the possibility to be measures (the string-values) and/or simple expressions that results in strings.
But as far as I can tell, this is already possible. No need of anything for this.
Eventually post a code, to can take a look.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: [Suggestion] Shape/Extend-Modifier and path: Measures and expressions

Post by ikarus1969 »

I have something like this in mind:

Example #1: switching Extend-Modifier with an expression

Code: Select all

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

[Variables]
Switch_Format=0


[Measure_CALC]
Measure=CALC
Formula=#Switch_Format#
OnUpdateAction=[!SetVariable "Switch_Format" "(1 - #Switch_Format#)"][!UpdateMeter "*"][!Redraw]
DynamicVariables=1

[Meter_Display]
Meter=SHAPE
Shape=Ellipse 100, 100, 90, 90 | Extend (#Switch_Format# = 0 ? "Format_RED" : "Format_BLUE")

Format_RED= StrokeWidth 6 | Stroke Color FF0000FF | Fill Color FFFFFFFF
Format_BLUE=StrokeWidth 6 | Stroke Color 004080FF | Fill Color FFFFFFFF

AntiAlias=1
DynamicVariables=1

[Meter_Var]
Meter=STRING
Text="#Switch_Format#"
X=100
Y=100
InlineSetting=Size | 48
StringAlign=CENTERCENTER
AntiAlias=1
DynamicVariables=1
Example #2: switching Extend-Modifier with a measure: in the meantime i got it working with a measure

Code: Select all

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

[Variables]
Switch_Format=0


[Measure_CALC]
Measure=CALC
Formula=#Switch_Format#
OnUpdateAction=[!SetVariable "Switch_Format" "(1 - #Switch_Format#)"][!UpdateMeasure "Measure_CALC_Format"][!UpdateMeter "*"][!Redraw]
DynamicVariables=1

[Measure_CALC_Format]
Measure=STRING
String=#Switch_Format#
Substitute="0":"Format_RED","1":"Format_BLUE"
DynamicVariables=1

[Meter_Display]
Meter=SHAPE
Shape=Ellipse 100, 100, 90, 90 | Extend [Measure_CALC_Format]

Format_RED= StrokeWidth 6 | Stroke Color FF0000FF | Fill Color FFFFFFFF
Format_BLUE=StrokeWidth 6 | Stroke Color 004080FF | Fill Color FFFFFFFF

AntiAlias=1
DynamicVariables=1

[Meter_Var]
Meter=STRING
Text="#Switch_Format#"
X=100
Y=100
InlineSetting=Size | 48
StringAlign=CENTERCENTER
AntiAlias=1
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Suggestion] Shape/Extend-Modifier and path: Measures and expressions

Post by balala »

ikarus1969 wrote:Example #1: switching Extend-Modifier with an expression
The formulas (like that used under the Extend part of the shape option of the [Meter_Display] meter) work ONLY with numeric values, strings aren't allowed. However a !SetOption bang can be used to set the appropriate option on the Shape meter:

Code: Select all

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

[Variables]
Switch_Format=0

[Measure_CALC]
Measure=CALC
Formula=#Switch_Format#
OnUpdateAction=[!SetVariable "Switch_Format" "(1 - #Switch_Format#)"][!UpdateMeter "*"][!Redraw]
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption Meter_Display Shape "Ellipse 100, 100, 90, 90 | Extend Format_RED"][!UpdateMeter "Meter_Display"][!Redraw]
IfFalseAction=[!SetOption Meter_Display Shape "Ellipse 100, 100, 90, 90 | Extend Format_BLUE"][!UpdateMeter "Meter_Display"][!Redraw]
DynamicVariables=1

[Meter_Display]
Meter=SHAPE
;Shape=Ellipse 100, 100, 90, 90 | Extend (#Switch_Format# = 0 ? "Format_RED" : "Format_BLUE")
Format_RED= StrokeWidth 6 | Stroke Color FF0000FF | Fill Color FFFFFFFF
Format_BLUE=StrokeWidth 6 | Stroke Color 004080FF | Fill Color FFFFFFFF
AntiAlias=1
DynamicVariables=1

[Meter_Var]
Meter=STRING
Text=#Switch_Format#
X=100
Y=100
InlineSetting=Size | 48
StringAlign=CENTERCENTER
AntiAlias=1
DynamicVariables=1
See that I commented out the Shape option of the [Meter_Display] meter, because this option is dynamically set through the !SetOption bangs, used into the IfTrueAction and IfFalseAction options of the [Measure_CALC] measure, according to the value of the Switch_Format variable, so it's useless to add it directly to the meter.
ikarus1969 wrote:Example #2: switching Extend-Modifier with a measure: in the meantime i got it working with a measure
This code works perfectly for me, without any modification. Doesn't it for you?
Post Reply