It is currently October 22nd, 2021, 9:51 am

slowdown switch

Tips and Tricks from the Rainmeter Community
User avatar
Judian81
Posts: 90
Joined: May 6th, 2021, 2:57 pm

slowdown switch

Post by Judian81 »

Hey hello rainmeter people,

i was busy with a project. and find something usefull to post i ques.

Code: Select all

[Rainmeter]
;the refresh rate of the skin is 20 milliseconds.
Update=20

[Variables]
;the slow down variable is here to cacht when measure is changed
vSlowDown=0
vSwitch=0

[MeasureNow]
;this measure change every second. but refreshed 20 milliseconds.
Measure=Time
;we need this because we want the possibility rewrite this part of the skin.
DynamicVariables=1
;when the measure is realy changed we set variable so we can use if condition
OnChangeAction=[!SetVariable vSlowDown 2]
;slow down is now in action. and will make it possible to set options and variables.
IfCondition=(#vSwitch# + #vSlowDown#) = 3
IfTrueAction=[!SetVariable vSlowDown 0][!SetOption MeterText Text "One"][!SetVariable vSwitch 0]
IfCondition2=(#vSwitch# + #vSlowDown#) = 2
IfTrueAction2=[!SetVariable vSlowDown 0][!SetOption MeterText Text "Two"][!SetVariable vSwitch 1]
;when we are done with setting options and variables we undo the slowdown part and is back waiting agian for real changes.

[MeterBackground]
Meter=Shape
Shape=Rectangle , , 200, 100

[MeterText]
Meter=String
Text="Waiting On Change"

Slowdown Switch_v0.2.rmskin
You do not have the required permissions to view the files attached to this post.
windows 10
User avatar
sl23
Posts: 889
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: slowdown switch

Post by sl23 »

What does it do? A description would be useful :D
User avatar
balala
Rainmeter Sage
Posts: 13337
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: slowdown switch

Post by balala »

sl23 wrote: September 4th, 2021, 5:54 pm What does it do? A description would be useful :D
:thumbup:
User avatar
death.crafter
Posts: 1058
Joined: April 24th, 2021, 8:13 pm

Re: slowdown switch

Post by death.crafter »

Judian81 wrote: August 31st, 2021, 1:54 am
I think a more feasible solution would be:

Code: Select all

[Rainmeter]
Update=20

[Variables]
SlowDownTimeInMilliSeconds=1000

; This should not be changed manually. If changed, must be in Range [1,3].
vSwitch=1

[Calc]
; Using Calc measure so I can change it at will.
Measure=Calc

; Every update, it switches between 0 and 1, so that we can execute OnChangeAction
Formula=(Calc=1?0:1)

; UpdateDivider is set to -1, so it's independent of skin's Update cycle.
UpdateDivider=-1
DynamicVariables=1

; Now I update the measure in an interval of milliseconds provided in the variable. It gives us an upper hand
; in comparison to Time measure. Since we can control the interval.
OnUpdateAction=[!Delay (#SlowDownTimeInMilliSeconds#)][!UpdateMeasure #CURRENTSECTION#]

; Then come the switches. Go wild.
IfCondition=(#vSwitch#=1)
IfTrueAction=[!SetOption MeterText Text "I am SwitchCase1"][!SetVariable vSwitch 2]
IfCondition2=(#vSwitch#=2)
IfTrueAction2=[!SetOption MeterText Text "I am SwitchCase2"][!SetVariable vSwitch 3]
IfCondition3=(#vSwitch#=3)
IfTrueAction3=[!SetOption MeterText Text "I am SwitchCase3"][!SetVariable vSwitch 1]

[MeterText]
Meter=String
Text=I am SwitchOutput
SolidColor=255,255,255
from the Realm of Death
My Current Desktop
User avatar
Judian81
Posts: 90
Joined: May 6th, 2021, 2:57 pm

Re: slowdown switch

Post by Judian81 »

sl23 wrote: September 4th, 2021, 5:54 pm What does it do? A description would be useful :D
in this case i used the timer plugin. in real situation i used the nowplaying plugin and the webnowplaying plugin.
when the cover changed i need to know if spotify is selected or one of the others like winamp or media player.
the cover picture is send to my exe file. and that is heave duty cause i see my mouse changing in the waiting icon every second.
so i build this to realease the presure and only being used when the picture is realy changing.
if spotify is selected send the spotify cover. and if not then send the winamp (nowplaying) cover.

so i used the timer plugin so you can test it right away. without having to install other files or things.

i set the update rate on 20. just to see that it is only doing something heavy when there is something realy changed.
windows 10
User avatar
Judian81
Posts: 90
Joined: May 6th, 2021, 2:57 pm

Re: slowdown switch

Post by Judian81 »

death.crafter wrote: September 5th, 2021, 3:13 am I think a more feasible solution would be:
is this in an endless loop?

cause i used UpdateDivider=-1 in my code and now there is not any onupdatechange anymore. :S
windows 10
User avatar
Judian81
Posts: 90
Joined: May 6th, 2021, 2:57 pm

Re: slowdown switch

Post by Judian81 »

death.crafter wrote: September 5th, 2021, 3:13 am
code
sorry to say but your code gets stuck if i refresh all the skin at the same time. it gets stuk in stage 3.
windows 10
User avatar
death.crafter
Posts: 1058
Joined: April 24th, 2021, 8:13 pm

Re: slowdown switch

Post by death.crafter »

death.crafter wrote: September 5th, 2021, 3:13 am I think a more feasible solution would be:
Okay, I was wrong. !Delay bangs persist even after Skin is refreshed. So the !UpdateMeasure bang before Refresh is executed post refresh, breaking the update cycle.

Sorry for the misleading post. :oops:
from the Realm of Death
My Current Desktop
User avatar
Judian81
Posts: 90
Joined: May 6th, 2021, 2:57 pm

Re: slowdown switch

Post by Judian81 »

death.crafter wrote: September 5th, 2021, 2:31 pm Okay, I was wrong. !Delay bangs persist even after Skin is refreshed. So the !UpdateMeasure bang before Refresh is executed post refresh, breaking the update cycle.

Sorry for the misleading post. :oops:
thanks for the help. :)
windows 10