It is currently May 4th, 2024, 7:49 am

Checking for Weather Alerts

Get help with creating, editing & fixing problems with skins
User avatar
mercury52
Posts: 32
Joined: December 30th, 2011, 12:43 pm
Location: Maryland, USA

Checking for Weather Alerts

Post by mercury52 »

I have separate parsing for a weather alert. All works fine if I just display the alert (it's either there or not there, displays something or nothing) but I'd like to check to see if it's there so I can do something else (like displaying a text WEATHER ALERT). Can't seem to figure out how to do that.

Can anybody give me some ideas, examples?

mercury52
User avatar
santa_ryan
Posts: 397
Joined: June 22nd, 2010, 4:11 am

Re: Checking for Weather Alerts

Post by santa_ryan »

Use the code block below to do what you want to do replacing anything with asterisks with you're own data.

Code: Select all

[WeatherAlertCheck]
Measure=Plugin
Plugin=WebParser.dll
URL=*NAME OF THE PARENT WEBPARSE*
StringIndex=*STRING INDEX OF THE CAPTURED WEATHER ALERT*
RegExpSubstitute=1
Substitute="\s":"0";"\S":"1"

[WeatherAlertExists]
Measure=Calc
Formula=[WeatherAlertCheck]
IfEqualValue=0
IfEqualAction=*WHAT TO DO IF WEATHER ALERT DOES NOT EXIST*
IfAboveValue=0
IfAboveAction=*WHAT TO DO IF WEATHER ALERT DOES EXIST*
What I did is:
1. Grab your parsed weather alert data.
2. * Substitute all non white space to 1s and all whitespace to 0s.
3. Send the new substituted string to a calc to convert from a string datatype to a number datatype.
4. Use the IfActions to specify actions.

* You must substitute all non white space characters to even get a match. You must substitute all white space characters otherwise the calc will still read a 0 because it doesn't understand anything other than numbers. Reason why I specify a 0 is because this also ensures no false positives if the webparse picks up whitespace from the data.
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.
User avatar
mercury52
Posts: 32
Joined: December 30th, 2011, 12:43 pm
Location: Maryland, USA

Re: Checking for Weather Alerts

Post by mercury52 »

Thanks for helping. Bear with me. Since you can only test it out when there is an actual alert I tried the following:
1. I (think) I did what you said and to test it out I changed the substitute values s=1 and S=0 assuming it would then display opposite of what I wanted; didn't do that.
2. I also displayed the string assuming it would contain 1s or 0s; nothing displayed.

When there is something in the string it contains six numbers.
I have included my code to see if you can spot something I did wrong. Didn't know how to add it like you did so I just copied it into this post.

[MeasureAlert]
Measure=Plugin
Plugin=WebParser.dll
URL=http://xml.weather.com/weather/local/USMD0443?cc=*&unit=f&dayf=2
RegExp="(?siU).*<locale>(.*)</locale>.*<ut>(.*)</ut>.*<ud>(.*)</ud>.*<us>(.*)</us>.*<up>(.*)</up>.*<ur>(.*)</ur>.*<loc id="(.*)">.*<dnam>(.*)</dnam>.*<tm>(.*)</tm>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>(.*)</zone>.*<a id="(.*)" uc="(.*)">.*<t>(.*)</t>.*<l>(.*)</l>.*"

;15 = number 6dig
;16 = number 1dig
;17 = alert words
;18 = alert web address

[MeasureAdvisoryNr]
Measure=plugin
Plugin=WebParser.dll
URL=[MeasureAlert]
StringIndex=15
RegExpSubstitute=1
Substitute="\s":"0";"\S":"1"

[CheckAdvisory]
Measure=Calc
Formula=[MeasureAdvisoryNr]
ifabovevalue=0
ifaboveaction=!execute [!RainmeterSHOWMeter MeterAdvisory1][!RainmeterSHOWMeter MeterAdvisory2][!RainmeterRedraw]
ifequalvalue=0
ifequalaction=!execute [!RainmeterHIDEMeter MeterAdvisory1][!RainmeterHIDEMeter MeterAdvisory2][!RainmeterRedraw]
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Checking for Weather Alerts

Post by jsmorley »

Just one quick hint, there is bound to be a weather alert somewhere at any given time. Just look at some national weather news site and find out where it is raining frogs and use that location for testing... ;-)
User avatar
mercury52
Posts: 32
Joined: December 30th, 2011, 12:43 pm
Location: Maryland, USA

Re: Checking for Weather Alerts

Post by mercury52 »

So obvious an idea that I never thought of it.

Well I found Seal Rock OR with a sever weather alert and the alert code is 658255 but my skin with the changes made from santa_ryan did not work. Arrrgh.
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

Space character problem

Post by kabott »

Hi, i cant seem to get this right, im trying to remove the space from the following adress so i can download the .gif, but well.. not working :P

help please :???:

" src="eurcandle_files/EURO_8172_image001.gif"

this is my code:

[Rainmeter]
Update=15000
DynamicWindowSize=1

[BG]
Meter=Image
SolidColor=0,0,0,255
X=0
Y=0
W=500
H=200

;///////////////////////////////////////////////////////////////
[Scan]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url="http://www.kshitij.com/graphgallery/eurcandle.shtml#candle"
RegExp="(?siU)position:absolute;z-index:3;margin-left:8px;margin-top:14px;width:685px;(.*)" v:shapes="_x0000_s263171""
StringIndex=1
FinishAction=!Update "#CURRENTCONFIG#"

[ScanB]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=[Scan]
StringIndex=1
DecodeCharacterReference=1
Substitute="height:324px'><![endif]><img width=685 height=324":"", "#CRLF#":"","\s":"","\s":""
FinishAction=!Update "#CURRENTCONFIG#"

;==============================

[Text]
Meter=STRING
MeasureName=ScanB
X=0
Y=0
FontColor= 255,255,255,160
FontSize= 9
FontFace= Arial
AntiAlias=1
StringEffect= BORDER
StringAlign= LEFT
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Checking for Weather Alerts

Post by jsmorley »

I would do something like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[BG]
Meter=Image
SolidColor=0,0,0,255
X=0
Y=0
W=500
H=200

;///////////////////////////////////////////////////////////////
[Scan]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.kshitij.com/graphgallery/eurcandle.shtml#candle
RegExp="(?siU)position:absolute;z-index:3;margin-left:8px;margin-top:14px;width:685px;.*"(.*)" v:shapes="_x0000_s263171""

[ScanB]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.kshitij.com/graphgallery/[Scan]
Download=1
StringIndex=1

;==============================

[Text]
Meter=STRING
MeasureName=ScanB
X=0
Y=0
FontColor=255,255,255,160
FontSize=9
FontFace=Arial
AntiAlias=1
StringEffect=BORDER
StringAlign=LEFT

[Image]
Meter=Image
MeasureName=ScanB
Y=2R
However, in the future please don't hijack threads that have nothing to do with your question. Just start a new thread.
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

Re: Checking for Weather Alerts

Post by kabott »

Ho..ok, i thought it was related because of the space character problem, anyways thanks for the help & sorry for the "Hijack" , next time ill start a new thread :)