It is currently April 25th, 2024, 1:25 pm

Dynamic list from webparser

Get help with creating, editing & fixing problems with skins
jarlrmai
Posts: 2
Joined: April 17th, 2014, 12:29 pm

Dynamic list from webparser

Post by jarlrmai »

Hi

I'm trying to create a skin which reads a list of names and urls from text file, this bit is fairly easy however I need to be able to add and remove items from the text file and have the web parser create the correct amount of string meters.

I followed the lookahead assertions guide, but I don't want to have a meter when I have no value. If I have 10 text items I want 10 string meters.

I have searched around but i'm not sure how to accomplish this.

Thanks

Jarl.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dynamic list from webparser

Post by jsmorley »

jarlrmai wrote:Hi

I'm trying to create a skin which reads a list of names and urls from text file, this bit is fairly easy however I need to be able to add and remove items from the text file and have the web parser create the correct amount of string meters.

I followed the lookahead assertions guide, but I don't want to have a meter when I have no value. If I have 10 text items I want 10 string meters.
If you want to have up to 10 text items, then you really will need 10 child WebParser measures and 10 meters. You can set any or all of the meters to Hidden=1, and use an IFMatch on the child measures to look for "" being returned by the measure. If that is false, unhide the corresponding meter, if it is true, hide it.

You really can't easily have WebParser (or anything else) "create" meters on the fly.
User avatar
pds
Posts: 79
Joined: April 12th, 2014, 12:52 pm
Location: Slovakia

Re: Dynamic list from webparser

Post by pds »

You must create something like this :
[Variables]
Get=(?(?=.*"time">).*"time">(.*)</span>

That means : search string "time" (?(?=.*"time">)
If find it, continue .*"time">(.*)</span> ........
If not , do nothing .


Then in RegExp you can use many #GET# .... RegExp=(?siU)#Get##Get##Get#
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dynamic list from webparser

Post by jsmorley »

pds wrote:You must create something like this :
[Variables]
Get=(?(?=.*"time">).*"time">(.*)</span>

That means : search string "time" (?(?=.*"time">)
If find it, continue .*"time">(.*)</span> ........
If not , do nothing .


Then in RegExp you can use many #GET# .... RegExp=(?siU)#Get##Get##Get#
Correct, but really not what he is asking though. He gets that part.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Dynamic list from webparser

Post by moshi »

you could do this by having one skin that has only the measures and then use a batch file or probably Lua to overwrite a second skin that has only the meters.

but seriously: that's pretty pointless.
User avatar
killall-q
Posts: 305
Joined: August 14th, 2009, 8:04 am

Re: Dynamic list from webparser

Post by killall-q »

You could use Lua and and regex to parse the file, then plug in #*CRLF*# (which will render as a line break in Rainmeter) between each line in one very long variable.

Source: Experience messing around with my notes skin.
jarlrmai
Posts: 2
Joined: April 17th, 2014, 12:29 pm

Re: Dynamic list from webparser

Post by jarlrmai »

Thanks for your replies. I will have a look.