It is currently March 28th, 2024, 11:53 pm

Skin not updating

Get help with creating, editing & fixing problems with skins
User avatar
Swiftzn
Posts: 13
Joined: December 13th, 2017, 9:07 am

Skin not updating

Post by Swiftzn »

Hey guys,

Very new to this so not sure if i have missed something

I have created a Rainmeter SKin that has one measure(This runs a powershell script and uses returned values) and one meter(Source to follow), it works fine but the problem i get is it never refreshes.
So it works when i manually refresh but i would like it to run/update every 5 mins.

The second question would be how to split the returned data from powershell.
Currently it returns a value that is three lines and Rainmeter treats them as one value, how would i split these up and create three different Meter's from it?

Code: Select all

[Rainmeter]
Update=1000
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,14
OnRefreshAction=[!CommandMeasure MeasureGetStats "Run"]

Code: Select all

[MeasureGetStats]
Measure=Plugin
Plugin=RunCommand
Program="powershell.exe"
Parameter="-inputformat none -command C:\Scripts\GetWorkerStats_test.ps1"
OutputFile=<invalid>.tmp
OutputType=ANSI
State=hide
UpdateDivider=120
FinishAction=[!UpdateMeter MeterMiner]

Code: Select all


[MeterMiner]
Meter=STRING
MeasureName=MeasureGetStats
MeterStyle=styleLeftText
X=10
Y=40
W=250
H=50
Any help would be appreciated
User avatar
Swiftzn
Posts: 13
Joined: December 13th, 2017, 9:07 am

Re: Skin not updating

Post by Swiftzn »

Alrighty i have improved this better by using a Webparser.

Only problem i have now is that the Hashrate only updates after the first update.
So if i click refresh it is set to 0,00 and if i wait for the update interval it then refreshes with the value.

Please note the Dynamic Variable Snippets i slapped in to try get it working may not be needed.

Code: Select all

[Rainmeter]
Update=1000
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,14
OnRefreshAction=[!CommandMeasure MeasureGetStats "Run"]


[Variables]
RxAddress=**REDACTED**
fontName=Trebuchet MS
textSize=8
colorText=255,255,255,205

[MeasureGetStats]
Measure=Plugin
Plugin=WebParser
URL=https://vertcoin.easymine.online/json/miner.php?address=**REDACTED**
RegExp=(?siU)"address":"(.*)".*"hashrate":(.*),".*,"balance":"(.*)",.*"estimateday":"(.*)",.*"actual":"(.*)",.*"earnings":"(.*)"
UpdateDivider=120

[MeasureAddress]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetStats]
StringIndex=1
UpdateDivider=120

[MeasureHashrate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetStats]
StringIndex=2
UpdateDivider=120
DynamicVariables=1

[MeasureUnpaidBalance]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetStats]
StringIndex=3
UpdateDivider=120

[MeasureEstimatePerDay]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetStats]
StringIndex=4
UpdateDivider=120

[MeasureActualPerDay]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetStats]
StringIndex=5
UpdateDivider=120

[MeasureTotalEarnings]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetStats]
StringIndex=6
UpdateDivider=120


[MeasureGetBalance]
Measure=Plugin
Plugin=WebParser
URL=https://bitinfocharts.com/vertcoin/address/**REDACTED**
RegExp=(?siU)>Balance: <div style="display:inline-block" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><b>(.*)<span class='muteds'>
UpdateDivider=120

[MeasureChild1]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetBalance]
StringIndex=1
UpdateDivider=120

[MeasureCalcHash]
Measure=Calc
DynamicVariables=1
Formula=MeasureHashrate/1000000
UpdateDivider=120

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[MeterTitle]
Meter=String
MeterStyle=styleTitle
Text=Vertcoin Miner
X=150
Y=12
W=225
H=18


[MeterMinerAddress]
Meter=String
MeasureName=MeasureAddress
MeterStyle=styleLeftText
X=40
Y=40
W=225
H=50

[MeterMinerHashRateLabel]
Meter=String
Text=Hashrate: 
MeterStyle=styleLeftText
X=10
Y=65
W=190
H=50

[MeterHashrate]
Meter=String
MeasureName=MeasureCalcHash
DynamicVariables=1
NumOfDecimals=2
MeterStyle=styleLeftText
Text=%1 MH/s
X=120
Y=65
W=190
H=50

[MeterPBalanceLabel]
Meter=String
Text=Pending Balance: 
MeterStyle=styleLeftText
X=10
Y=80
W=190
H=50

[MeterPBalance]
Meter=String
MeasureName=MeasureUnpaidBalance
MeterStyle=styleLeftText
X=120
Y=80
W=190
H=50

[MeterEPDLabel]
Meter=String
Text=Estimated per 24H : 
MeterStyle=styleLeftText
X=10
Y=95
W=190
H=50

[MeterEPD]
Meter=String
MeasureName=MeasureEstimatePerDay
MeterStyle=styleLeftText
X=120
Y=95
W=190
H=50

[MeterAPDLabel]
Meter=String
Text=Actual per 24H : 
MeterStyle=styleLeftText
X=10
Y=110
W=190
H=50

[MeterAPD]
Meter=String
MeasureName=MeasureActualPerDay
MeterStyle=styleLeftText
X=120
Y=110
W=190
H=50

[MeterTotalEarningsLabel]
Meter=String
Text=Total Earnings : 
MeterStyle=styleLeftText
X=10
Y=125
W=190
H=50

[MeterTotalEarnings]
Meter=String
MeasureName=MeasureTotalEarnings
MeterStyle=styleLeftText
X=120
Y=125
W=190
H=50

[MeterBalanceLabel]
Meter=String
MeterStyle=styleLeftText
Text=Balance: 
X=10
Y=150
W=190
H=50

[MeterBalance]
Meter=String
MeasureName=MeasureChild1
MeterStyle=styleLeftText
X=120
Y=150
W=190
H=50


User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin not updating

Post by balala »

Swiftzn wrote:Only problem i have now is that the Hashrate only updates after the first update.
So if i click refresh it is set to 0,00 and if i wait for the update interval it then refreshes with the value.
Not knowing the value of the RxAddress variable, we can't get the [MeasureGetStats] measure to work. Please post a possible value for the needed variable.
Furtherly, I'm not sure, are still interested into your first question?
User avatar
Swiftzn
Posts: 13
Joined: December 13th, 2017, 9:07 am

Re: Skin not updating

Post by Swiftzn »

Apologies

The address would be VnjXzFr9iXvpRGC4bi9pdcvB6usFjNbE4U

I am still interested in my first question as with the updated code i posted it only seems to refresh once then stops.

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

Re: Skin not updating

Post by Brian »

RunCommand will only run when the command is triggered, not during normal Update operations.
See "Overview" : https://docs.rainmeter.net/manual/plugins/runcommand/

In your case, your RunCommand measure MeasureGetStats is triggered with OnRefreshAction. This means that RunCommand measure will only be run once when the skin is loaded and/or refreshed.

To execute a RunCommand at a regular interval, you will need a "counter" measure that will trigger the RunCommand at a specified rate. I think it could be accomplished using IfActions with the built-in counter option for the Calc measure, or with the Loop measure.
https://docs.rainmeter.net/manual/measures/general-options/ifactions/
https://docs.rainmeter.net/manual/measures/general-options/ifconditions/
https://docs.rainmeter.net/manual/measures/calc/#Functions
https://docs.rainmeter.net/manual/measures/loop/

Some extra help:
https://docs.rainmeter.net/tips/counters-guide/

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

Re: Skin not updating

Post by jsmorley »

Brian wrote:RunCommand will only run when the command is triggered, not during normal Update operations.
See "Overview" : https://docs.rainmeter.net/manual/plugins/runcommand/

In your case, your RunCommand measure MeasureGetStats is triggered with OnRefreshAction. This means that RunCommand measure will only be run once when the skin is loaded and/or refreshed.

To execute a RunCommand at a regular interval, you will need a "counter" measure that will trigger the RunCommand at a specified rate. I think it could be accomplished using IfActions with the built-in counter option for the Calc measure, or with the Loop measure.
https://docs.rainmeter.net/manual/measures/general-options/ifactions/
https://docs.rainmeter.net/manual/measures/general-options/ifconditions/
https://docs.rainmeter.net/manual/measures/calc/#Functions
https://docs.rainmeter.net/manual/measures/loop/

Some extra help:
https://docs.rainmeter.net/tips/counters-guide/

-Brian
You probably don't need a complicated Counter or Loop measure. Just take advantage of UpdateDivider.

Code: Select all

[MeasureRunit]
Measure=Calc
UpdateDivider=300
OnUpdateAction=[!CommandMeasure SomeMeasure "Run"]
Runs the command every 5 minutes.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin not updating

Post by balala »

Swiftzn wrote:Only problem i have now is that the Hashrate only updates after the first update.
This is caused by the UpdateDivider=120 option, added to each child WebParser measure. Remove them.
On the other hand, I have a remark.
On the parent WebParser measures (in this case [MeasureGetStats] and [MeasureGetBalance]) usually we don't use UpdateDivider options. It's not a too big mistake, it can be used even there, but usually instead we're using the UpdateRate option. Details here: https://docs.rainmeter.net/tips/update-guide/

In the meantime, you got the reply about your first question, from Brian and jsmorley, so, I don't post mine too.
User avatar
Swiftzn
Posts: 13
Joined: December 13th, 2017, 9:07 am

Re: Skin not updating

Post by Swiftzn »

Thanks for all the replies. learnt a lot already
Thanks balala, their responses do infact answer my original question, though i have switched the run command for a webparser so no longer needed,
i will be removing the UpdateDivider from the child ones and looking into the UpdateRate

Thanks for all the help so far guys
First skin so still learning haha.

***EDIT***

And now it works perfectly thanks you all.
This can turn out to be very useful for reporting and monitoring haha
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin not updating

Post by balala »

I'm glad if I helped.
Just one more: the !CommandMeasure bang can still be used on the WebParser measures, but in a bit different form. You don't have to Run the parent WebParser measure, but to Update it. So the [!CommandMeasure MeasureGetStats "[color=#FF0000]Run[/color]"] bang would be [!CommandMeasure MeasureGetStats "[color=#00FF00]Update[/color]"]. Not needed usually, but if you want to manually update the WebParser measure (trough a click, for example), this is how you have to do it. Just be careful to use under the !CommandMeasure, the parent WebParser measure, not a child one. If you don't use UpdateDivider on the child measure, they will by updated immediately after the parent measure.
Swiftzn wrote:First skin so still learning haha.
Go ahead and feel free to come back with any question, if you have any.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin not updating

Post by jsmorley »

balala wrote:I'm glad if I helped.
Just one more: the !CommandMeasure bang can still be used on the WebParser measures, but in a bit different form. You don't have to Run the parent WebParser measure, but to Update it. So the [!CommandMeasure MeasureGetStats "[color=#FF0000]Run[/color]"] bang would be [!CommandMeasure MeasureGetStats "[color=#00FF00]Update[/color]"]. Not needed usually, but if you want to manually update the WebParser measure (trough a click, for example), this is how you have to do it. Just be careful to use under the !CommandMeasure, the parent WebParser measure, not a child one. If you don't use UpdateDivider on the child measure, they will by updated immediately after the parent measure.

Go ahead and feel free to come back with any question, if you have any.
To be clear, child measures have their value set "by" the parent measure when it executes, not "after". They are updated normally as well, for purposes of executing IfCondition or OnChangeAction options and such on them, but their value is not set by the measure update process. It is set by the parent measure itself. It's why in 99.9% of cases, UpdateDivider makes no sense on a WebParser child measure.