It is currently April 25th, 2024, 4:01 pm

Parsing a local file with WebParser

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Parsing a local file with WebParser

Post by jsmorley »

We had always assumed you could not parse a local file on your hard drive with WebParser. Turns out that you in fact can.

Alex2539 discovered that if you use this format:

[MeasureText]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=file://C:\Users\YourName\Documents\TextFile.txt
RegExp="(?siU)Stuff to search for(.*)End of Search"

It works just fine and returns values in StringIndexes as with any other WebParser measure.

No "catch" here folks. It just works.
Jondar
Posts: 1
Joined: August 10th, 2009, 6:28 pm

Re: Parsing a local file with WebParser

Post by Jondar »

Thanks for posting this! I was just about to ask whether WebParser could handle file:// URLs, as I had thought it should work. Nice to know that it does. Now I'm off to hopefully update my skin layout to take advantage of this :)

~Jondar
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Parsing a local file with WebParser

Post by Alex2539 »

I love being mentioned by name ;) I'm anxious to see how everyone handles this newfound feature.
ImageImageImageImage
User avatar
Varelse
Posts: 61
Joined: April 22nd, 2009, 7:46 pm

Re: Parsing a local file with WebParser

Post by Varelse »

Wow. Thanks so much for posting this. This has greatly simplified some of my skins. Instead of using 5 different qouteplugin measures, I only need one webparser one.
User avatar
Varelse
Posts: 61
Joined: April 22nd, 2009, 7:46 pm

Re: Parsing a local file with WebParser

Post by Varelse »

It should be mentioned that if UpdateRate is not used on the regexp measure, then the webparser.dll will only update every 10 minutes on the newer versions of Rainmeter. Something kinda useful to know if you need to update the skin every second.
CybOrSpasm
Posts: 146
Joined: January 8th, 2011, 7:12 pm
Location: Tennessee

Re: Parsing a local file with WebParser

Post by CybOrSpasm »

Could this now be used to do a random quote from a local text file? if so, can you give me an example please? Thank you! };]
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Parsing a local file with WebParser

Post by poiru »

CybOrSpasm wrote:Could this now be used to do a random quote from a local text file? if so, can you give me an example please? Thank you! };]
The QuotePlugin would be better for that.