xenium wrote:Hi
In the example below, the temperature is displayed in green, yellow or red, depending on the three temperature intervals.
I would like that when the temperature value is green and click on it, slide the green image (meter1);
when the value is yellow and click on it, slide the yellow image (meter2);
when the value is red and click on it, slide the red image (meter3)
How can I do this?
thanks
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
SkinWidth=210
[Variables]
UpdateRateSeconds=600
FontFace=arial
;green
URL=https://www.foreca.com/Canada/Nunavut/Coral_Harbour
;yellow
;URL=https://www.foreca.com/Finland/Helsinki
;red
;URL=https://www.foreca.com/Singapore/Singapore
TempColor1=0,255,0
TempColor2=255,255,0
TempColor3=255,0,0
OffSet1=210
OffSet2=210
OffSet3=210
State1=1
State2=3
State3=5
U1=[!UpdateMeasure MeasureSlider][!UpdateMeter "Meter1"][!Redraw]
U2=[!UpdateMeasure MeasureSlider][!UpdateMeter "Meter2"][!Redraw]
U3=[!UpdateMeasure MeasureSlider][!UpdateMeter "Meter3"][!Redraw]
[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft1, 2, 22 | ChangeToState2
SlideLeft1=[!SetVariable OffSet1 "(Clamp(#OffSet1#-10,0,210))"]#U1#
ChangeToState2=[!SetVariable State1 2]
ActionList2=Repeat SlideRight1, 2, 22 | ChangeToState1
SlideRight1=[!SetVariable OffSet1 "(Clamp(#OffSet1#+10,0,210))"]#U1#
ChangeToState1=[!SetVariable State1 1]
ActionList3=Repeat SlideLeft2, 2, 22 | ChangeToState4
SlideLeft2=[!SetVariable OffSet2 "(Clamp(#OffSet2#-10,0,210))"]#U2#
ChangeToState4=[!SetVariable State2 4]
ActionList4=Repeat SlideRight2, 2, 22 | ChangeToState3
SlideRight2=[!SetVariable OffSet2 "(Clamp(#OffSet2#+10,0,210))"]#U2#
ChangeToState3=[!SetVariable State2 3]
ActionList5=Repeat SlideLeft3, 2, 22 | ChangeToState6
SlideLeft3=[!SetVariable OffSet3 "(Clamp(#OffSet3#-10,0,210))"]#U3#
ChangeToState6=[!SetVariable State3 6]
ActionList6=Repeat SlideRight3, 2, 22 | ChangeToState5
SlideRight3=[!SetVariable OffSet3 "(Clamp(#OffSet3#+10,0,210))"]#U3#
ChangeToState5=[!SetVariable State3 5]
DynamicVariables=1
[MeasureTemp]
Measure=WebParser
Url=#URL#
RegExp="(?siU)<span class=".* txt-xxlarge"><strong>(.*)</strong>.*"
UpdateRate=#UpdateRateSeconds#
StringIndex=1
[MeasureColor]
Measure=Calc
Formula=(((MeasureTemp >= -15) && (MeasureTemp < 0)) ? 1 : (((MeasureTemp >= 0) && (MeasureTemp <= 15)) ? 2 : 3))
========================================
[BG]
Meter=Image
SolidColor=0,0,0,100
X=0
Y=0
W=210
H=260
[Meter1]
Meter=Image
SolidColor=0,255,0
X=#OffSet1#
Y=20
W=203
H=240
DynamicVariables=1
[Meter2]
Meter=Image
SolidColor=255,255,0
X=#OffSet2#
Y=20
W=203
H=240
DynamicVariables=1
[Meter3]
Meter=Image
SolidColor=255,0,0
X=#OffSet3#
Y=20
W=203
H=240
DynamicVariables=1
[MeterTemp]
Meter=String
MeasureName=MeasureTemp
X=70
Y=185
W=100
H=100
FontColor=[#TempColor[&MeasureColor]]
StringStyle=bold
StringEffect=SHADOW
FontFace=arial
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
FontSize=15
Postfix="°C"
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Execute [#state[&MeasureColor]]"]
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Execute #StateA#"]
to
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Execute [#state[&MeasureColor]]"]
(Don't forget to change them on the [MeasureSlider] as well.)
By the way, unless you WANT to have 3 meters for each color, you can always have 1 meter with the color set as a variable.
Also consider adding a [!Stop ....] command in your mouse action for instant response when clicking fast.
Something like:
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Execute 2"]