It is currently April 20th, 2024, 12:28 am

[Solved] WebParse play sound on measure change

Get help with creating, editing & fixing problems with skins
tuneguy
Posts: 2
Joined: April 11th, 2017, 12:14 am

[Solved] WebParse play sound on measure change

Post by tuneguy »

Hi, I am not having any luck getting my sound to play more than once. I am using webParse to get the current number of visitors on my site. When the number is higher than before (a new visitor) I would like it to play the sound.

Here is my code:

Code: Select all

[Variables]
lastCount=0

[MeasureParent]
Measure=Plugin
Plugin=WebParser
UpdateRate=60
URL=http://mysiteurl/visitorcount
RegExp=(?siU)<title>(.*)</title>

[MeasureVisitors]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1
IfAboveValue=#lastCount#
IfAboveAction=[PLAY "click.wav"][!setVariable lastCount [MeasureVisitors]]
DynamicVariables=1
Last edited by tuneguy on April 11th, 2017, 7:43 am, edited 1 time in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5398
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: WebParse play sound on measure change

Post by eclectic-tech »

Your code works if I substitute a local file for the webparser URL source, and increment the value.

You should look at the 'Skin' tab of the !Log and see what your measures are returning...
visitor.png
You do not have the required permissions to view the files attached to this post.
tuneguy
Posts: 2
Joined: April 11th, 2017, 12:14 am

Re: WebParse play sound on measure change

Post by tuneguy »

eclectic-tech wrote:Your code works if I substitute a local file for the webparser URL source, and increment the value.

You should look at the 'Skin' tab of the !Log and see what your measures are returning...visitor.png

Thanks so much for pointing out the variable log!!! That helped me troubleshoot the issue. The error in my code was that I was not updating #lastCount# when the measure value was equal to or below #lastCount#. Here is the working code for anyone else that may need it:

Code: Select all

[Variables]
lastCount=0

[MeasureParent]
Measure=Plugin
Plugin=WebParser
UpdateRate=10
URL=https://siteURL/counter
RegExp=(?siU)<title>(.*)</title>

[MeasureVisitors]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1
IfAboveValue=#lastCount#
IfAboveAction=[PLAY "click.wav"][!setVariable lastCount [MeasureVisitors]]
IfEqualValue=#lastCount#
IfEqualAction=[!setVariable lastCount [MeasureVisitors]]
IfBelowValue=#lastCount#
IfBelowAction=[!setVariable lastCount [MeasureVisitors]]
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5398
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [Solved] WebParse play sound on measure change

Post by eclectic-tech »

The !Log is a great troubleshooting tool!

Your first code worked because you had 'DynamicVariables=1' on [MeasureVisitors], (you removed it in your second post).
It will increase the #lastcount# variable every time, as long as you don't !Refresh the skin.

You could add [!WriteKeyValue Variables lastcount [MeasureVisitors]] to the IfAboveAction=..., to permanently set lastcount to the new value, even if you !Refresh the skin.

Glad to help!