It is currently April 24th, 2024, 2:42 pm

WebParser plugin and RegExp

General topics related to Rainmeter.
User avatar
Cultman
Posts: 4
Joined: March 24th, 2015, 10:24 pm
Location: Brazil

WebParser plugin and RegExp

Post by Cultman »

Hello everyone.

I tried build one gadget for use on rainmenter skin and i need that this gadget return results on this page below or at least part of content start for "=>":

http://redirector.c.youtube.com/report_mapping

I did this code below but the results were not satisfactory.

[MeasureYTIP]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://redirector.c.youtube.com/report_mapping
RegExp="(?siU)[a-z0-9](.*)"
StringIndex=1
UpdateRate=3600
UpdateDivider=1000


Somebody can't help-me?

Thanks!
MikeG621
Posts: 87
Joined: March 18th, 2013, 1:59 pm

Re: WebParser plugin and RegExp

Post by MikeG621 »

Well what your Regex basically says is "after a single letter or number, return everything else", which obviously isn't what you're looking for.

If what you're looking for is "after '=>', return everything else", then what you'll want is:

Code: Select all

Regex="(?siU)>\s(.*)"
Including the '=' isn't really necessary.

I'm guessing that you want everything after the '=>', your post didn't translate into English clearly.
User avatar
Cultman
Posts: 4
Joined: March 24th, 2015, 10:24 pm
Location: Brazil

Re: WebParser plugin and RegExp

Post by Cultman »

MikeG621 wrote:I'm guessing that you want everything after the '=>', your post didn't translate into English clearly.
Exactly. Sorry, i'm Brazilian and not speak english accurately.

The code does not work here, or result is blank. Full code below:

Code: Select all

[Variables]
FontName=Ubuntu
FontColor=255,255,255,240
FontSize=9

..................................................................................................

[MeasureYTIP]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://redirector.c.youtube.com/report_mapping
RegExp="(?siU)>\s(.*)"
StringIndex=1
UpdateRate=3600
UpdateDivider=1000

[MesureYT2]
Measure=STRING

..................................................................................................

[MeterYT]
MeasureName=MeasureYTIP
Meter=STRING
X=190
Y=5
FontFace=#FontName#
FontColor=#FontColor#
FontSize=28
AntiAlias=1
;StringStyle=Bold
StringAlign=Right
Text="%1"

..................................................................................................
Thaks for help!
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: WebParser plugin and RegExp

Post by FreeRaider »

I use an example:

123.34.567.9 => somename-som10 (79.142.1.25/19)
if you want somename-som10 (79.142.1.25/19) use

Code: Select all

RegExp=(?siU)^.*\>\s+(.*)$
Your (modified) code:

Code: Select all

[Rainmeter]
Update=10000
DynamicWindowSize=1
AccurateText=1

[MeasureYTIP]
Measure=Plugin
Plugin=WebParser
URL=http://redirector.c.youtube.com/report_mapping
RegExp=(?siU)^.*\>\s+(.*)$
UpdateRate=3600
StringIndex=1

[MesureYT2]
Measure=STRING

[MeterYT]
Meter=STRING
MeasureName=MeasureYTIP
FontSize=15
FontColor=255,255,255,255
FontFace=Segoe UI Light
x=420r
y=0r
ClipStringW=340
ClipStringH=400
ClipString=2
SolidColor=0,0,0,150
AntiAlias=1
DynamicVariables=1
and this is the result
image_2.png
Post Scriptum: You can use Help: Rainmeter Skins for help.
You do not have the required permissions to view the files attached to this post.
User avatar
Cultman
Posts: 4
Joined: March 24th, 2015, 10:24 pm
Location: Brazil

Re: WebParser plugin and RegExp

Post by Cultman »

Thank you very much FreeRaider, the code works. :great:

If i only want this part of the code "somename-som10", as i mount?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: WebParser plugin and RegExp

Post by eclectic-tech »

Cultman wrote:Thank you very much FreeRaider, the code works. :great:

If i only want this part of the code "somename-som10", as i mount?
If there is always a 'space' after "somename-som10", this should work:

Code: Select all

RegExp=(?siU)^.*\>\s+(.*)\s.*$
User avatar
Cultman
Posts: 4
Joined: March 24th, 2015, 10:24 pm
Location: Brazil

Re: WebParser plugin and RegExp

Post by Cultman »

Thanks friends, i solved my doubt. Below result and code modified:

Code: Select all

..................................................................................................

[Variables]
FontName=Ubuntu
FontColor=255,255,255,240
FontSize=9

..................................................................................................

[MeasureYTIP]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://redirector.c.youtube.com/report_mapping
RegExp="(?siU)^.*\>\s+(.*)\s.*$"
StringIndex=1
UpdateRate=3600

[MeasureWANIP]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://checkip.dyndns.org
RegExp="(?siU)<body>(.+)Address: (.+)</body>"
StringIndex=2
UpdateRate=1800
UpdateDivider=3600

[MeasureLAN]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=IP_ADDRESS
SysInfoData=0
UpdateDivider=#Update#

..................................................................................................

[MeterLAN]
Meter=STRING
MeasureName=MeasureLAN
FontColor=ffffff
x=120r
y=0r
ClipStringW=340
ClipStringH=400
ClipString=2
AntiAlias=1
DynamicVariables=1
Postfix="  /  "

[MeterWAN]
Meter=STRING
MeasureName=MeasureWANIP
FontColor=ffffff
x=87r
y=0r
ClipStringW=340
ClipStringH=400
ClipString=2
AntiAlias=1
DynamicVariables=1
Postfix="  /  "

[MeterYT]
Meter=STRING
MeasureName=MeasureYTIP
FontColor=ffffff
x=105r
y=0r
ClipStringW=340
ClipStringH=400
ClipString=2
AntiAlias=1
DynamicVariables=1

..................................................................................................
Thank you, one more time. :thumbup:
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: WebParser plugin and RegExp

Post by FreeRaider »

Cultman wrote:Thank you very much FreeRaider, the code works. :great:
Glad to help