It is currently May 5th, 2024, 11:33 pm

[Suggestion] FinishAction on Child WebParser Measures

Report bugs with the Rainmeter application and suggest features.
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

[Suggestion] FinishAction on Child WebParser Measures

Post by Brian »

Is it possible to implement FinishAction on "child" WebParser measures? The reason is because sometimes I use WebParser to parse through a long list, and before WebParser sets each StringIndex in the "child" measures, the FinishAction gets called on the "parent" measure sometimes resulting in display errors.

I think it would be nice to be able to use FinishAction on a specific "child" measure so I know that the value is set before performing some action.

Hope that makes sense.

-Brian
Last edited by Brian on January 9th, 2012, 11:54 pm, edited 1 time in total.
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: [Suggestion]FinishAction on Child WebParser Measures

Post by ~Faradey~ »

Brian wrote:Is it possible to implement FinishAction on "child" WebParser measures?
Pls, look at example http://rainmeter.net/forum/viewtopic.php?f=15&t=10844 ( it uses child measure and FinishAction in it)
Is that what you need?
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Suggestion]FinishAction on Child WebParser Measures

Post by Brian »

hmmm. Maybe its just me.:confused: I have tried to use FinishAction in "child" measures before with no luck, so I just assumed it only worked with the "parent" measure since that is where the downloading takes place.

If I can replicate the problem, I will post it. :D

-Brian
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Suggestion]FinishAction on Child WebParser Measures

Post by Brian »

Ok, I think I can show you what I mean.

Consider this code:

Code: Select all

[Website]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://rainmeter.net/cms
UpdateRate=3600
RegExp="(?siU)<img src="(.*)".*<h2>Download</h2>.*<b>(.*)</b>"

[Picture]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://rainmeter.net[Website]
Download=1
FinishAction=!ShowMeter DisplayPicture
StringIndex=1

[Version]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[Website]
FinishAction=!ShowMeter DisplayVersion
StringIndex=2

[DisplayPicture]
Meter=Image
MeasureName=Picture
X=0
Y=0
Hidden=1

[DisplayVersion]
Meter=String
MeasureName=Version
X=0
Y=0
FontColor=255,255,255
SolidColor=0,0,0,1
Hidden=1
This grabs the first image on the main site, and the current version number. The picture displays just fine (so, FinishAction works), BUT the version does not display.

My first assumption was that the picture was "on top" of the text, so I commented out the line: FinishAction=!ShowMeter DisplayPicture. The Version still does not display.

Next, I uncomment out the FinishAction=!ShowMeter DisplayPicture, and comment out this: Hidden=1 in [DisplayVersion]. This time, the picture comes up, and the version......so, my thinking is FinishAction did not work correctly. I believe [Version] is the only true "child" measure in this example.

-Brian
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: [Suggestion]FinishAction on Child WebParser Measures

Post by ~Faradey~ »

Brian wrote:Ok, I think I can show you what I mean.

Consider this code:

Code: Select all

[Website]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://rainmeter.net/cms
UpdateRate=3600
RegExp="(?siU)<img src="(.*)".*<h2>Download</h2>.*<b>(.*)</b>"

[Picture]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://rainmeter.net[Website]
Download=1
FinishAction=!ShowMeter DisplayPicture
StringIndex=1

[Version]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[Website]
FinishAction=!ShowMeter DisplayVersion
StringIndex=2

[DisplayPicture]
Meter=Image
MeasureName=Picture
X=0
Y=0
Hidden=1

[DisplayVersion]
Meter=String
MeasureName=Version
X=0
Y=0
FontColor=255,255,255
SolidColor=0,0,0,1
Hidden=1
This grabs the first image on the main site, and the current version number. The picture displays just fine (so, FinishAction works), BUT the version does not display.

My first assumption was that the picture was "on top" of the text, so I commented out the line: FinishAction=!ShowMeter DisplayPicture. The Version still does not display.

Next, I uncomment out the FinishAction=!ShowMeter DisplayPicture, and comment out this: Hidden=1 in [DisplayVersion]. This time, the picture comes up, and the version......so, my thinking is FinishAction did not work correctly. I believe [Version] is the only true "child" measure in this example.

-Brian
try add "#CURRENTCONFIG#" to all FinishAction

like this,

Code: Select all

FinishAction=!ShowMeter DisplayPicture "#CURRENTCONFIG#"
Is that means we can only use one FinishAction when using relative paths, url, you ask?
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Suggestion]FinishAction on Child WebParser Measures

Post by Brian »

No effect when adding "#CURRENTCONFIG#" to all FinishActions.

-Brian
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Suggestion]FinishAction on Child WebParser Measures

Post by jsmorley »

Yes, I have never known "FinishAction" to work on a "child" WebParser measure, only on a "parent" one. It is fired by WebParser when it "finishes retrieving information from the website", and is not a general purpose action upon completion of the measure. The [Picture] measure does in fact go out to the website to get the image, so the FinishAction is fired.

I would be fine in principle with making FinishAction work on "child" measures if it is possible without drastic changes to WebParser. Although I must say, "child" measures are very dependent on the "parent" going out to a website to get new information, and I'm not sure I see the point, as you can put as many FinishAction "actions" on the parent as you like. Seems to me that it is more cosmetic than anything else to put FinishActions on separate "child" measures.

In any case, for now, I think the rule is just that it only works on "parent" measures. It is due to the fact that the function was written in conjunction with the routines that go out to a website. "Child" measures do not.