It is currently March 29th, 2024, 3:19 pm

WebParser variables - Setting them

Report bugs with the Rainmeter application and suggest features.
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

WebParser variables - Setting them

Post by Chewtoy »

Yes. It has been requested before (or at least asked for).

But I wonder. Has anyone looked in to it?
Right now seems a pressing time to request it, as I need it. -.-'

But it would be good if we were able to set variables based on the stringindexs that the webparser gives us in some simple manor of

[String1]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=[MeasureUrl]
StringIndex=1
SetVariable=Variable


Where the Variable would obviously be the variable that depends on the stringindex.
Then the possiblities for WebParser would be enourmus. ._.

Another option would be if we could use measures as part of things such as !bangs in this manor:

[String1]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=[MeasureUrl]
StringIndex=1

[MeterForSomethingWithABang]
Meter=String
X=R
Y=R
FontColor=#FontColor#
FontFace=#FontFace#
FontSize=#FontSize#
LeftMouseDownAction=!Execute ["Url[String1]"]

Or something...
I don't think, therefore I'm not.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser variables - Setting them

Post by jsmorley »

Chewtoy wrote:Yes. It has been requested before (or at least asked for).

But I wonder. Has anyone looked in to it?
Right now seems a pressing time to request it, as I need it. -.-'

But it would be good if we were able to set variables based on the stringindexs that the webparser gives us in some simple manor of

[String1]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=[MeasureUrl]
StringIndex=1
SetVariable=Variable


Where the Variable would obviously be the variable that depends on the stringindex.
Then the possiblities for WebParser would be enourmus. ._.

Another option would be if we could use measures as part of things such as !bangs in this manor:

[String1]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=[MeasureUrl]
StringIndex=1

[MeterForSomethingWithABang]
Meter=String
X=R
Y=R
FontColor=#FontColor#
FontFace=#FontFace#
FontSize=#FontSize#
LeftMouseDownAction=!Execute ["Url[String1]"]

Or something...


While the first is not possible today, you can in fact use a measure in an !Execute statement. I use the capability in my "Speaking Clock" for instance:

[MeasureNewHour]
Measure=Time
Format=%#M

[MeasureSpeakHour]
Measure=Time
Format=%#I

[MeasureSpeak]
Measure=CALC
Formula=MeasureNewHour
IfEqualAction=!Execute ["#CURRENTPATH#SpeakingClock.exe" "It+is+[MeasureSpeakHour]+O'Clock"]
IfEqualValue=0
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: WebParser variables - Setting them

Post by Chewtoy »

For some reason I can't get the part you posted to work no matter which way I try it.

LeftMouseDownAction=!Execute ["http://localhost:8888/?cmd=Start&param1=[StringI3]"]
LeftMouseDownAction=!Execute ["http://localhost:8888/?cmd=Start&param1=[StringI3]]
LeftMouseDownAction=!Execute [http://localhost:8888/?cmd=Start&param1=[StringI3]"]
LeftMouseDownAction=!Execute [http://localhost:8888/?cmd=Start&param1=[StringI3]]
LeftMouseDownAction=!Execute [""http://localhost:8888/?cmd=Start&param1=[StringI3]""] <-- Opens C:\ btw.

Now. What is wrong in that part? To me it seems that I have ton any possible way. But I can of course be wrong. As I so often am.
I don't think, therefore I'm not.
MattKing
Developer
Posts: 98
Joined: August 6th, 2009, 3:03 pm

Re: WebParser variables - Setting them

Post by MattKing »

I can't get this to work either. Jsmorley is a liar nice fellow.
Last edited by MattKing on December 22nd, 2009, 10:45 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser variables - Setting them

Post by jsmorley »

Chewtoy wrote:For some reason I can't get the part you posted to work no matter which way I try it.

LeftMouseDownAction=!Execute ["http://localhost:8888/?cmd=Start&param1=[StringI3]"]
LeftMouseDownAction=!Execute ["http://localhost:8888/?cmd=Start&param1=[StringI3]]
LeftMouseDownAction=!Execute [http://localhost:8888/?cmd=Start&param1=[StringI3]"]
LeftMouseDownAction=!Execute [http://localhost:8888/?cmd=Start&param1=[StringI3]]
LeftMouseDownAction=!Execute [""http://localhost:8888/?cmd=Start&param1=[StringI3]""] <-- Opens C:\ btw.

Now. What is wrong in that part? To me it seems that I have ton any possible way. But I can of course be wrong. As I so often am.
When you run this, what is the value of StringI3 in "About"?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser variables - Setting them

Post by jsmorley »

MattKing wrote:I can't get this to work either. Jsmorley is a liar.

[MeasureSpeakTime]
Measure=Time
Format=%#I:%M

Then in a meter:

LeftMouseDownAction=!Execute ["#CURRENTPATH#SpeakingClock.exe" "It+is+[MeasureSpeakTime]"]

this works fine, I promise.

Just for grins, I changed it to this, and it still works fine.

LeftMouseDownAction=!Execute ["http://cnns.com?cmd=[MeasureSpeakTime]"]

CNN yaks up a hairball of course but the URL is correct for what I would expect to be passed.

http://cnns.com?cmd=5:23

You guys are tards... ;-)
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: WebParser variables - Setting them

Post by Chewtoy »

Okey. I found the little pester of it all. Your code works perfectly Js. Thanks! Things should be smoother from there.
It is however a problem with the where [StringI3] gets its info.
(?=<tr onclick="a\('(.*)'\)" class=") <-- That's the line that's parsed. But if used mutiple times, it just returnes the same thing over and over. Which lead to StringI1 == StringI2 == StringI3 and so on... While they should have different values.

I've also tried (?(?=<tr onclick="a\('(.*)'\)" class=")), but that returens totaly wrong things.
But all that really fits in the help section, so I think I'll be posting there.


But the use of Measures in linking works!
I don't think, therefore I'm not.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser variables - Setting them

Post by jsmorley »

Chewtoy wrote:Okey. I found the little pester of it all. Your code works perfectly Js. Thanks! Things should be smoother from there.
It is however a problem with the where [StringI3] gets its info.
(?=<tr onclick="a\('(.*)'\)" class=") <-- That's the line that's parsed. But if used mutiple times, it just returnes the same thing over and over. Which lead to StringI1 == StringI2 == StringI3 and so on... While they should have different values.

I've also tried (?(?=<tr onclick="a\('(.*)'\)" class=")), but that returens totaly wrong things.
But all that really fits in the help section, so I think I'll be posting there.


But the use of Measures in linking works!
"Look Around" assertions in Regular Expressions can be tricky little buggers...