It is currently April 20th, 2024, 6:29 am

Trailing Zeros

General topics related to Rainmeter.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

You need to update [PriceAsNumber] at the same time. You are in a sense having the FinishAction "step over [PriceAsNumber]", and update the meter while [PriceAsNumber] still has no value.

FinishAction=[!ShowMeter Graph1][!UpdateMeasure PriceAsNumber][!UpdateMeter Graph1]
[!Redraw]
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

P.S. I'm not at all happy seeing UpdateRate=10 causing a WebParser measure to hit a financial site every 10 seconds. Welcome to their block list soon... Trust me, no financial site you have access to if your last name isn't "Pickens" and your first name isn't "T Boone" will be updating at anything approaching 10 second intervals. 5 minutes is plenty often.
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

jsmorley wrote:P.S. I'm not at all happy seeing UpdateRate=10 causing a WebParser measure to hit a financial site every 10 seconds. Welcome to their block list soon... Trust me, no financial site you have access to if your last name isn't "Pickens" and your first name isn't "T Boone" will be updating at anything approaching 10 second intervals. 5 minutes is plenty often.
It's only for the testing purposes, the base value will be 300 or 600.

I tought WebParser is handled dynamically and after it downloads a value from the site, each meter gets updated which using that parser.
Maybe it would be better just to save it's value to a variable and handle it dynamically?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

Resike wrote: I thought WebParser is handled dynamically and after it downloads a value from the site, each meter gets updated which using that parser.
Maybe it would be better just to save it's value to a variable and handle it dynamically?
Meters that use values from WebParser measures do in fact dynamically update with the current value the WebParser measure has right away, on that same skin update.

The issue is that you are NOT using the value of the WebPasrser measure in the meter, but the value of that Calc measure used to convert the string to a number. So if you are going to use a FinishAction to "poke the meter" to update "right now", as soon as the WebParser measure is finished, without waiting for the next skin update, you need to also "poke" the Calc measure so it stays in sync.

It is probably worth knowing that the way Rainmeter processes a skin update cycle is:

1) Update all measures, in the order they are in the skin
2) Update all meters, in the order they are in the skin
3) Redraw the entire skin

However an "action" like !UpdateMeasure or !UpdateMeter will take place "now" as soon as the action is fired. This allows you to quickly take some action outside of the normal update cycle, but you have to then manage any "dependencies" yourself. If you update a meter "now", out of the normal order, and don't update the measure(s) it is using first, the update of the meter can be pointless.
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

jsmorley wrote: Meters that use values from WebParser measures do in fact dynamically update with the current value the WebParser measure has right away, on that same skin update.

The issue is that you are NOT using the value of the WebPasrser measure in the meter, but the value of that Calc measure used to convert the string to a number. So if you are going to use a FinishAction to "poke the meter" to update "right now", as soon as the WebParser measure is finished, without waiting for the next skin update, you need to also "poke" the Calc measure so it stays in sync.

Then how come when i use the parser directly at the inital tick (even force update them) the string gets updated properly but not the graph?

Code: Select all

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

[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=10
FinishAction=[!UpdateMeter MeterResult] [!ShowMeter Graph1] [!UpdateMeter Graph1] [!Redraw]

[MeterResult]
Meter=String
MeasureName=ParsePrice
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,20
AntiAlias=1
UpdateDivider=3600
NumOfDecimals=1

[Graph1]
Meter=Line
AutoScale=1
X=1
Y=20
W=52
H=14
MeasureName=ParsePrice
LineColor=faba00
UpdateDivider=3600
Hidden=1

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

Re: Trailing Zeros

Post by jsmorley »

I'm not entirely sure. Does seem like there is one skin update lag between WebParser getting the value and the graph showing the first "tick". Not sure I can explain that right off. I'll have to chew on it a bit.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trailing Zeros

Post by balala »

Try to modify the FinishAction of the [ParsePrice] measure to: FinishAction=[!UpdateMeasure PriceAsNumber][!ShowMeter Graph1][!UpdateMeter Graph1][!Redraw]
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

balala wrote:Try to modify the FinishAction of the [ParsePrice] measure to: FinishAction=[!UpdateMeasure PriceAsNumber][!ShowMeter Graph1][!UpdateMeter Graph1][!Redraw]
As jsmorley told the same, thats a working workaround.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

I think your best bet is to have the entire skin only appear after WebParser is "finished" the first time when the skin is first loaded or refreshed.

Code: Select all

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

[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=100
FinishAction=[!ShowMeterGroup MyMeters]

[MeterResult]
Meter=String
Group=MyMeters
MeasureName=ParsePrice
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,20
AntiAlias=1
Hidden=1

[Graph1]
Meter=Line
Group=MyMeters
AutoScale=1
X=1
Y=20
W=52
H=14
MeasureName=ParsePrice
LineColor=faba00
Hidden=1
With that there is no visible "lag" between WebParser getting the information and the skin displaying it. When the meters appear, string or graph, there will be information in them.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

To be honest, I'd be tempted to stop fighting any "lag" with WebParser having to go out and get the information while the skin moves on, and just save and use a "persistent" previous value as a starting point. Then you can just let the skin operate without any intervention, and it will work about as well as can be expected.

Code: Select all

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

[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=100
FinishAction=[!SetOption CurrentPrice Formula "[ParsePrice]"][!WriteKeyValue CurrentPrice Formula "[ParsePrice]"]

[CurrentPrice]
Measure=Calc
Formula=1.1200

[MeterStringPrice]
Meter=String
MeasureName=CurrentPrice
W=50
H=14
FontSize=11
FontColor=255,255,255,255
SolidColor=27,37,47,255
Padding=5,5,5,5
NumOfDecimals=4
AntiAlias=1

[MeterLineGraphPrice]
Meter=Line
X=0
Y=0R
W=60
H=20
MeasureName=CurrentPrice
AutoScale=1
LineColor=250,186,0,255
SolidColor=57,67,77,255
1.png
You do not have the required permissions to view the files attached to this post.