It is currently April 28th, 2024, 11:24 am

Help needed with RegExps counting whitespaces...

General topics related to Rainmeter.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help needed with RegExps counting whitespaces...

Post by jsmorley »

Actually, you are doing that all wrong. What you want to do is what I described in my post explaining StringIndex. Just use ONE Webparser measure that actually hits the web site. Get all the captures at once. Then use "child" measures to pick the values off and go after the child measures in your meters.

You are just beating that site to death the way you are doing it, and you can hang WebParser if you ask it to go get another drink from the well before it has finished the previous one.

You might want to unload that skin, restart Rainmeter, then fix your approach before you load the skin again.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Help needed with RegExps counting whitespaces...

Post by Kyremi »

I can't seem to get a debug text file to be created... I added debug=2 to the end of the last webparser but it doesn't appear in my C: drive...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help needed with RegExps counting whitespaces...

Post by jsmorley »

Also VERY VERY important.

You have UpdateRate=1 on your WebParser measures. What that means is that you are hitting that site multiple times, once a second. You are in effect acting exactly like a DoS attack.. ;-)

Set UpdateRate to something reasonable like 300 (5 minutes) or remove that line altogether, which will default to 600 (10 minutes).

This is critical, do it now, before you get locked out of that site.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help needed with RegExps counting whitespaces...

Post by jsmorley »

Kyremi wrote:I can't seem to get a debug text file to be created... I added debug=2 to the end of the last webparser but it doesn't appear in my C: drive...
See my previous post. You have almost certainly hung WebParser (which may actually be a good thing) and need to change or remove those UpdateRate= lines and restart Rainmeter.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Help needed with RegExps counting whitespaces...

Post by Kyremi »

jsmorley wrote: See my previous post. You have almost certainly hung WebParser (which may actually be a good thing) and need to change or remove those UpdateRate= lines and restart Rainmeter.
Restarted Rainmeter, got this error; Failed to dump debug data: c:\WebParserDump.txt... also changed the update rate to 100 in the measure, with a default of 1000.

edit: got a value through :) now working on doing the whole WebParser stuff properly...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help needed with RegExps counting whitespaces...

Post by jsmorley »

Well, I hardly think you need to hit a weather site once every 1.6 minutes, but ok.

See my other post about using "child" measures so you are not going back out to the site for every value you want.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Help needed with RegExps counting whitespaces...

Post by Kyremi »

Just to make sure I understand that child measures post... my current RegExp looks like this:

Code: Select all

RegExp="(?siU).* .* .* .* (.*) (.*) (.*) (.*) (.*) (.*) (.*) .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* (.*) .* (.*) (.*) .* (.*) (.*) .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* (.*) (.*) .* .* .* (.*) (.*) (.*)  .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* (.*) "
So I can use StringIndex=1 in a new measure to get the first (.*), and StringIndex=4 to get the 4th one, etc.?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help needed with RegExps counting whitespaces...

Post by jsmorley »

Kyremi wrote:Just to make sure I understand that child measures post... my current RegExp looks like this:

Code: Select all

RegExp="(?siU).* .* .* .* (.*) (.*) (.*) (.*) (.*) (.*) (.*) .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* (.*) .* (.*) (.*) .* (.*) (.*) .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* (.*) (.*) .* .* .* (.*) (.*) (.*)  .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* (.*) "
So I can use StringIndex=1 in a new measure to get the first (.*), and StringIndex=4 to get the 4th one, etc.?
Exactly. Be VERY sure that the RegExp is on one line. Looks to me like you have line breaks in what you posted to make it easier to read, but WebParser will just hate that like a red-headed-stepchild.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Help needed with RegExps counting whitespaces...

Post by Kyremi »

Current code:

Code: Select all

[MainMeasure]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=100
Url=http://www.sheffieldweather.co.uk/meso2/clientraw.txt
RegExp="(?siU).* .* .* .* (.*) (.*) (.*) (.*) (.*) (.*) (.*) .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* (.*) .* (.*) (.*) .* (.*) (.*) .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* (.*) (.*) .* .* .* (.*) (.*) (.*)  .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* .* 

.* .* .* .* .* .* .* .* .* .* .* .* .* .* (.*) "

[MeasureActualTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=1
I can't seem to get rid of the linebreaks, and I get a WebParser: [MainMeasure] Matching error! (-8) message... every time I try to delete the linebreaks it seems to add new ones wherever the limits of the window are...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help needed with RegExps counting whitespaces...

Post by jsmorley »

You need to turn off "line wrapping" in your text editor, so you can be sure it is all on one line. Many if not most editors will make it "look" like it is on separate lines by wrapping it in the editor, but you want to be sure it isn't actually chopping it into separate lines.