It is currently May 24th, 2024, 2:54 am

Repeat IfAboveAction in regular intervals

Get help with creating, editing & fixing problems with skins
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Repeat IfAboveAction in regular intervals

Post by Asagrim »

Hello!

I have the following code: (note: i set the calc formula relation intentionally backwards so i could test if it works!)

Code: Select all

[Ms_CPUTemp]
Measure=Plugin
Plugin=Plugins\CoreTemp.dll
CoreTempType=MaxTemperature

[Ms_CPUTempTjMax]
Measure=Plugin
Plugin=Plugins\CoreTemp.dll
CoreTempType=TjMax

[Ms_CPUTempCalc]
Measure=Calc
Formula=Ms_CPUTemp<Ms_CPUTempTjMax
IfAboveValue=0
IfAboveAction=!Execute ["#ROOTCONFIGPATH#Addons\JSMSpeak2.exe" "Warning! CPU temperature above tolerance level!" "en"]
This works just fine if i load the skin - the warning is audible. However if i add any UpdateDivider to it, the script maybe repeats the message twice in absolutely uneven intervals, then it mutes for good. (It's not flood protection, i added the same bang to LeftMouseUpAction and spammed it for like 80 times, always worked.)

How could this script be modified in order to hear this warning message exactly every 30 seconds as long as the IfAboveValue condition is met?

Thanks for any help!
User avatar
Brian
Developer
Posts: 2696
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Repeat IfAboveAction in regular intervals

Post by Brian »

Asagrim wrote:How could this script be modified in order to hear this warning message exactly every 30 seconds as long as the IfAboveValue condition is met?
Try setting your Update to 1000 (in the [Rainmeter] section), then set UpdateDivider to 30 in your Calc.

Here is some more information on UpdateDivider.

-Brian
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: Repeat IfAboveAction in regular intervals

Post by Asagrim »

Brian wrote:Try setting your Update to 1000 (in the [Rainmeter] section), then set UpdateDivider to 30 in your Calc.

Here is some more information on UpdateDivider.

-Brian

I had the same values as you suggested before posting. I have Update=1000 and set UpdateDivider to 30 on these measures. It didn't work. (I only pasted this fragment without [Rainmeter] and others because the entire code is now 1784 lines, this is the fragment i have problems with).
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Repeat IfAboveAction in regular intervals

Post by smurfier »

Try this:

Code: Select all

[Ms_CPUTemp]
Measure=Plugin
Plugin=Plugins\CoreTemp.dll
CoreTempType=MaxTemperature

[Ms_CPUTempTjMax]
Measure=Plugin
Plugin=Plugins\CoreTemp.dll
CoreTempType=TjMax

[Ms_CPUTempCalc]
Measure=Calc
Formula=Ms_CPUTemp<Ms_CPUTempTjMax
IfAboveValue=0
IfAboveAction=!EnableMeasure cCalc
IfBelowValue=1
IfBelowAction=!DisableMeasure cCalc

[cCalc]
Formula=Calc
Formula=cCalc%30+1
IfEqualValue=1
IfEqualAction=!Execute ["#ROOTCONFIGPATH#Addons\JSMSpeak2.exe" "Warning! CPU temperature above tolerance level!" "en"]
Disabled=1
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Repeat IfAboveAction in regular intervals

Post by jsmorley »

The problem is with how IfxxxxAction works. It is fired one time when the condition becomes "true" and then is not fired again until the condition becomes "false" and then back to "true" again.

So you can't have a repeating action using an IfxxxxAction if the value remains "true".

However, you can do something like this:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
CoreTemp=50

[MeasureCheckTemp]
Measure=Calc
Formula=#CoreTemp#
DynamicVariables=1
IfAboveValue=39
IfAboveAction=!EnableMeasure MeasureCounter
IfBelowValue=40
IfBelowAction=!DisableMeasure MeasureCounter

[MeasureCounter]
Measure=Calc
Formula=Counter % 31
IfEqualValue=1
IfEqualAction=Play #CURRENTPATH#Click.wav
Disabled=1

[MeterOne]
Meter=Image
W=25
H=25
SolidColor=255,255,255,255
LeftMouseUpAction=!SetVariable CoreTemp 30
What this does is use the value from your CoreTemp measure(s) (I don't have CoreTemp, so I just faked it with a variable that I can change with a click on that image meter) and then if the value is above some target, "enable" the [MeasureCounter] measure that counts to 30 (seconds, as Update=1000) and does some action. I just have it play a sound for this sample.

When the value of the CoreTemp measure(s) fall below the target, the [MeasureCounter] measure is "disabled", so it stops counting and playing the sound.
User avatar
Brian
Developer
Posts: 2696
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Repeat IfAboveAction in regular intervals

Post by Brian »

Maybe I am misunderstanding something, but shouldn't your formula be: "Formula=Ms_CPUTemp>Ms_CPUTempTjMax"?

The way you have it suggests that the maximum temperature of your cores is less than the maximum rated temperature from the manufacturer - then run the command.....don't you want it to be if the maximum temperature of your cores is greater than the maximum rated temperature from the manufacturer?

Or am I missing something?

-Brian
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Repeat IfAboveAction in regular intervals

Post by jsmorley »

Smurfie was too fast for me. His approach is a variant of mine. Either will work.
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: Repeat IfAboveAction in regular intervals

Post by Asagrim »

Brian wrote:
Or am I missing something?

-Brian
Yes, you miss that that i've set the relation intentionally wrong, so it would be true, so i can test the code. I mentioned it right before the code fragment. :)
User avatar
Brian
Developer
Posts: 2696
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Repeat IfAboveAction in regular intervals

Post by Brian »

:) oops... :D

-Brian
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Repeat IfAboveAction in regular intervals

Post by jsmorley »

Be careful if you use Smurfier's code, I think he is missing a "!DisableMeasure" to turn the action back off when the value falls back below the target. If you add that, his works well.