Hello, Gentleman, am new to Rainmeter. Been having great fun. My first skin has a flashing light (LightBeam2.png). The OnUpdateAction combined with the value of MeasureBlinkString works fine, but I'd like to click on the image and toggle it on/off as it can be distracting (alpha=255 for off). I have NOT found any of the if statements to work. I did manage to use a variable called Toggle to hide/display text by varying from 0 to 1 using LeftMouseUpAction, but have not found a way to switch of the blinking for the image. I thought of using a conditional for #Toggle# to use or skip the blinking ImageAlpha statement, but have failed at many attempts. Any help? Thanks Much in Advance. Al
[Variables]
Toggle=1
[MeasureBlinkString1]
Measure=Calc
Formula=MeasureBlinkString1 = 0 ? 200 : 0
DynamicVariables=1
[MeterBlinkingImage]
Meter=Image
ImageName=#@#Images\LightBeam2.png
LeftMouseUpAction=[!SetVariable Toggle "(1-#Toggle#)"][!UpdateMeter *][!Redraw]
OnUpdateAction=!SetOption MeterBlinkingImage ImageAlpha "[MeasureBlinkString1]"
W=800
H=1000
X=-1r
Y=-999
DynamicVariables=1
It is currently April 25th, 2024, 6:26 am
How To Toggle Blinking Image Off/On
-
- Posts: 10
- Joined: February 7th, 2018, 7:08 am
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How To Toggle Blinking Image Off/On
Add the following Calc measure to your code:Cusanus wrote:but have not found a way to switch of the blinking for the image.
Code: Select all
[MeasureBlinking]
Measure=Calc
Formula=#Toggle#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!PauseMeasure "MeasureBlinkString1"]
IfFalseAction=[!UnpauseMeasure "MeasureBlinkString1"]
DynamicVariables=1
Just note that the OnUpdateAction option of the [MeterBlinkingImage] meter seems useless. I'd simply replace it with an ImageAlpha=[MeasureBlinkString1] option.
-
- Posts: 10
- Joined: February 7th, 2018, 7:08 am
Re: How To Toggle Blinking Image Off/On
Wow, thanks a ton. I did try various conditionals as documented, but am not good setting up context, new to Rainmeter code this week and not the brightest bulb in the box. The OnUpdateAction gives some control over blinking rate using UpdateDivider=x, but maybe like you say that isn't necessary. Suppose I should have tried your suggestions first, but I'll do that now. -Edit ---> Works like a charm, thanks so much.balala wrote:Add the following Calc measure to your code:Initially, when the Toggle variable is equal to 1, the IfCondition is false, so the IfFalseAction option is executed. Its !UnpauseMeasure bang, is unpausing the [MeasureBlinkString1] measure, due to this, it enables the blinking. If you click, the Toggle variable switches to 0 and in this moment, the set IfCondition becomes true, so the IfTrueAction is executes. This one pauses the blinking. On a new click, the Toggle variable is set again to 1 and everything restarts.Code: Select all
[MeasureBlinking] Measure=Calc Formula=#Toggle# IfCondition=(#CURRENTSECTION#=0) IfTrueAction=[!PauseMeasure "MeasureBlinkString1"] IfFalseAction=[!UnpauseMeasure "MeasureBlinkString1"] DynamicVariables=1
Just note that the OnUpdateAction option of the [MeterBlinkingImage] meter seems useless. I'd simply replace it with an ImageAlpha=[MeasureBlinkString1] option.
Edit again... Sorry, still checking this out. The toggle does work, yes, but it now toggles three states, blinking, no blink with image alpha transparent, no blink opaque, apparently. This is fine in a sense, why not have the projector off or on solid, trouble is it is random whether off or on, so perhaps a minor glitch but will think about this more.
OK, finally! Replaced the 1st IfCondition with this one:
IfCondition=(MeasureBlinkString1 > 0) && (#CURRENTSECTION#=0)
Now it always stops while the image is opaque. Finally! I'm learning, slow but...
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How To Toggle Blinking Image Off/On
I don't think so. You're right about the fact that theoretically there would be three states, but practically when the image is transparent, you can't click it to stop the blinking. This can be done only when the image is opaque, so the blinking can be stopped only in this case. Finally you have just two possibilities: blinking or the not blinking but opaque image.Cusanus wrote:Sorry, still checking this out. The toggle does work, yes, but it now toggles three states, blinking, no blink with image alpha transparent, no blink opaque, apparently.
If that's not correct in your case, please post the whole code of your skin. Just to can take a look...