It is currently February 4th, 2023, 3:27 am

Disable Measure apparently not working

Get help with creating, editing & fixing problems with skins
PinkRabi
Posts: 2
Joined: May 5th, 2010, 10:23 am

Disable Measure apparently not working

Post by PinkRabi »

So I currently I have a gmail notifier skin which plays a random sound from a specific folder every time I get a new email. What I'm trying to do is have a button which disables the MakeSound measure so it stops producing sounds when I want it to. The code I have is shown below, however this doesn't appear to work, since sounds are still played whenever an email is received. Can anyone help me see where I have gone wrong? Is one of the first skins I've tinkered with and wondering if I've missed a trick with how to use bang or something.

Full code:

Code: Select all

[Variables]
@include=#SKINSPATH#\WP7\Common\Variables\UserVariables.inc
@include1=#SKINSPATH#\WP7\Panels\Mail\UserVariables.inc
Previous=0

[Background]
Meter=IMAGE
Background=#Imagedir#\panel.png

[bg]
Meter=Image
ImageName=#Imagedir#\btn3.png

[mail]
Meter=Image
ImageName=mailhoveri2.png
X=32
Y=22
LeftMouseDownAction=!execute ["https://#GmailUsername#:#GmailPassword#@gmail.google.com/]

[MeasureGmail]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=https://#GmailUsername#:#GmailPassword#@gmail.google.com/gmail/feed/atom
RegExp="(?siU)<fullcount>(.*)</fullcount>"
Codepage=0
Download=1
UpdateRate=4
StringIndex=4
Substitute="":"no new"

[MeasureNumber]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureGmail]
StringIndex=1
UpdateRate=1
Substitute="":"no"
IfEqualValue=0
IfEqualAction=!execute [!RainmeterShowMeter NoMessages][!RainmeterHideMeter Number]
IfAboveValue=0
IfAboveAction=!execute [!RainmeterHideMeter NoMessages][!RainmeterShowMeter Number]

[Random]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#SKINSPATH#\WP7\Panels\Mail\Sounds
Subfolders=1

[MakeSound]
Measure=CALC
Formula=[MeasureNumber] - #Previous#
IfAboveValue=0
IfAboveAction=PLAY [Random]
PLAY #Random#
DynamicVariables=1

[MeasureSetCount]
Measure=CALC
Formula=#Previous#
IfAboveValue=-1000000
IfAboveAction=!RainmeterSetVariable Previous MeasureNumber
DynamicVariables=1

;------------------------------------------------------------------------------------------------
; METERS

[Number]
Meter=STRING
MeasureName=MeasureNumber
X=77
Y=82
FontColor=255, 255, 255
FontFace=Segoe UI Light
FontSize=30
StringAlign=CENTER
StringStyle=NORMAL
AntiAlias=1
Text="%1 new"
AntiAlias=1
AutoScale=1
NumOfDecimals=0

[NoMessages]
Meter=STRING
X=77
Y=82
FontColor=255, 255, 255
FontFace=Segoe UI Light
FontSize=30
StringAlign=CENTER
StringStyle=NORMAL
AntiAlias=1
Text="no new"
AntiAlias=1
AutoScale=1
Hidden=1

[SoundOff]
Meter=IMAGE
X=0
Y=0
ImageName=SoundOn.png
LeftMouseDownAction=!execute [!RainmeterDisableMeasure MakeSound][!RainmeterHideMeter SoundOff][!RainmeterShowMeter SoundOn][!RainmeterRedraw]

[SoundOn]
Meter=IMAGE
X=0
Y=0
ImageName=SoundOff.png
LeftMouseDownAction=!execute [!RainmeterEnableMeasure MakeSound][!RainmeterShowMeter SoundOff][!RainmeterHideMeter SoundOn][!RainmeterRedraw]
Hidden=1
Important bits:

Code: Select all

[MakeSound]
Measure=CALC
Formula=[MeasureNumber] - #Previous#
IfAboveValue=0
IfAboveAction=PLAY [Random]
PLAY #Random#
DynamicVariables=1
;-------------------------------------
[SoundOff]
Meter=IMAGE
X=0
Y=0
ImageName=SoundOn.png
LeftMouseDownAction=!execute [!RainmeterDisableMeasure MakeSound][!RainmeterHideMeter SoundOff][!RainmeterShowMeter SoundOn][!RainmeterRedraw]

[SoundOn]
Meter=IMAGE
X=0
Y=0
ImageName=SoundOff.png
LeftMouseDownAction=!execute [!RainmeterEnableMeasure MakeSound][!RainmeterShowMeter SoundOff][!RainmeterHideMeter SoundOn][!RainmeterRedraw]
Hidden=1
Thanks in advance
User avatar
maminscris
Posts: 509
Joined: April 24th, 2009, 3:17 pm
Location: Bucharest, Romania Lat 44,43° Lon 26,1°

Re: Disable Measure apparently not working

Post by maminscris »

LeftMouseDownAction=!RainmeterEnableMeasure MakeSound SkinName without extension
Zero at programing, zero at writing codes, so far 2 at making images
But I'm good at copy/paste, and I not always like this
Image
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Disable Measure apparently not working

Post by kenz0 »

Actually, dynamic measure cannot change a state directly by the bang.
If you add DynamicVariables=1 to the measure, it always repeats the update. It will return to a default state immediately even if you send !RainmeterDisableMeasure command.

The following is an example for solving this problem.

Code: Select all

[Variables]
@include=#SKINSPATH#\WP7\Common\Variables\UserVariables.inc
@include1=#SKINSPATH#\WP7\Panels\Mail\UserVariables.inc
Previous=0
state=0
;-------------------------------------

[MakeSound]
Measure=CALC
Formula=[MeasureNumber] - #Previous#
IfAboveValue=0
IfAboveAction=PLAY [Random]
PLAY #Random#
DynamicVariables=1
Disabled=#state#
;-------------------------------------
[SoundOff]
Meter=IMAGE
X=0
Y=0
ImageName=SoundOn.png
LeftMouseDownAction=!execute [!RainmeterSetVariable state 1][!RainmeterHideMeter SoundOff][!RainmeterShowMeter SoundOn][!RainmeterRedraw]

[SoundOn]
Meter=IMAGE
X=0
Y=0
ImageName=SoundOff.png
LeftMouseDownAction=!execute [!RainmeterSetVariable state 0][!RainmeterShowMeter SoundOff][!RainmeterHideMeter SoundOn][!RainmeterRedraw]
Hidden=1
.
Image
PinkRabi
Posts: 2
Joined: May 5th, 2010, 10:23 am

Re: Disable Measure apparently not working

Post by PinkRabi »

Works correctly now! Thank you for the explanation as well as the solution, definitely helps the learning process.