It is currently May 2nd, 2024, 7:12 am

Help with webparser please.

Get help with creating, editing & fixing problems with skins
presha
Posts: 5
Joined: May 15th, 2011, 11:24 am

Help with webparser please.

Post by presha »

Hi, I have some problems with the webparser. This is the part of the website's code :

Code: Select all

<td align='right'>717 (2.45%)</td>
Those numbers change every time I refresh the page. To parse only them I use this expression:

Code: Select all

(?siU)<td align='right'>(.*)<
which works and returns "717 (2.45%)" which is good for horizontal skin. The problem is want them both in different lines so in Rainmeter it looks like:
717
(2.45%)
Is there any way to break the line/wrap the text using webparser? If not, how can I separate those two lines into separate strings? Now I've been messing with the special characters with "\" but I just cant get this to work. Please help me :)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with webparser please.

Post by jsmorley »

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureSite]
Measure=Plugin
Plugin=WebParser.dll
URL=file://#CURRENTPATH#Test.txt
; File contains: <td align='right'>717 (2.45%)</td>
RegExp="(?siU)'right'>(.*) (.*)<"

[MeasurePart1]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureSite]
StringIndex=1

[MeasurePart2]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureSite]
StringIndex=2

[FontStyle]
FontFace=Trebuchet MS
FontSize=11
FontColor=255,255,255,255
StringStyle=Bold
AntiAlias=1

[MeterPart1]
Meter=String
MeasureName=MeasurePart1
MeterStyle=FontStyle
X=0
Y=0

[MeterPart2]
Meter=String
MeasureName=MeasurePart2
MeterStyle=FontStyle
X=0
Y=R

[MeterBoth]
Meter=String
MeasureName=MeasurePart1
MeasureName2=MeasurePart2
MeterStyle=FontStyle
X=0
Y=R
H=30
Text=%1#CRLF#%2
presha
Posts: 5
Joined: May 15th, 2011, 11:24 am

Re: Help with webparser please.

Post by presha »

wow thanks for the quick help :) I've been messing for hour with the expression and you just used two (.*) .. didnt expect this to be so simple hah :)

btw. do you have some app which generated the code or did you write it all by yourself? kinda quick :)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with webparser please.

Post by jsmorley »

You are welcome...

For the skin code, I just do it off the top of my head. There are no code generators or anything like that for Rainmeter, and I wouldn't use one if there was, since like ALL code generators it would be crap. When I am doing a new skin, I mostly just steal from my old ones...

As to the RegExp, simple stuff like that I just knock out. For more complicated ones I use:

http://rainmeter.net/forum/viewtopic.php?f=18&t=769