I'm a long time user of Rainmeter and really love the program. I've recently been developing my own skins and ran into a little issue.
I can't get the UpdateMeasure bang to work on a Webparser measure from within LUA. I've attached a test skin along with the LUA I'm using.
Any help is appreciated!
It is currently April 28th, 2024, 2:51 am
[Solved] Update Plugin Measure from LUA
-
- Posts: 56
- Joined: December 27th, 2011, 12:32 pm
[Solved] Update Plugin Measure from LUA
You do not have the required permissions to view the files attached to this post.
Last edited by prince1142003 on April 5th, 2012, 5:57 am, edited 1 time in total.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Update Plugin Measure from LUA
The problem is that the WebParser measure has an UpdateDivider of -1, which is all well and good. (I understand that you want to control its update with the script and not on each update of the skin in any way) However, since you don't have any UpdateRate on the WebParser measure, it will only "go out to the internet" and thus only run "FinishAction" every 10 minutes, which is the default for UpdateRate.
I made it:
Which if I am not mistaken, will still only update the measure in general by the !UpdateMeasure in the script, but when the measure IS updated, it will actually go out and get another copy of the .rdf and run the FinishAction.
You might want to play around and ensure that it is doing exactly what you want, but I think that is the key.
I made it:
Code: Select all
[MeasureWebParser]
Measure=Plugin
Plugin=WebParser
UpdateDivider=-1
UpdateRate=1
Url=http://slashdot.org/slashdot.rdf
Download=1
ForceReload=1
FinishAction=!CommandMeasure "MeasureScript" "Two()"
You might want to play around and ensure that it is doing exactly what you want, but I think that is the key.
-
- Developer
- Posts: 2688
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: Update Plugin Measure from LUA
I think the problem might be that you have no UpdateRate. If UpdateRate is not defined, it defaults to 600 or 10 minutes. So even though you update the measure, it really wont download the page for 10 minutes.
You might want to use EnableMeasure/DisableMeasure instead of UpdateMeasure.
Your .ini file:Then your .lua file:This should work, but haven't tested it yet.....(not at my computer)
-Brian
You might want to use EnableMeasure/DisableMeasure instead of UpdateMeasure.
Your .ini file:
Code: Select all
[MeasureWebParser]
Measure=Plugin
Plugin=WebParser
Url=http://slashdot.org/slashdot.rdf
Download=1
ForceReload=1
FinishAction=!Execute [!CommandMeasure "MeasureScript" "Two()"][!DisableMeasure MeasureWebParser]
Disabled=1
Code: Select all
function Update()
local t = os.time()
local freq = 30
if t >= tonumber(SKIN:GetVariable('One')) then
print(tonumber(SKIN:GetVariable('One')))
SKIN:Bang('!Execute [!EnableMeasure "MeasureWebParser"][!Redraw]')
SKIN:Bang('!SetVariable "One" "'..round(t+freq-(t%freq)+1)..'"')
end
end
-Brian
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: Update Plugin Measure from LUA
Unless you set UpdateRate=1 in MeasureWebParser, it would not pull the website until 600 updates later.Brian wrote:I think the problem might be that you have no UpdateRate. If UpdateRate is not defined, it defaults to 600 or 10 minutes. So even though you update the measure, it really wont download the page for 10 minutes.
You might want to use EnableMeasure/DisableMeasure instead of UpdateMeasure.
Your .ini file:Then your .lua file:Code: Select all
[MeasureWebParser] Measure=Plugin Plugin=WebParser Url=http://slashdot.org/slashdot.rdf Download=1 ForceReload=1 FinishAction=!Execute [!CommandMeasure "MeasureScript" "Two()"][!DisableMeasure MeasureWebParser] Disabled=1
This should work, but haven't tested it yet.....(not at my computer)Code: Select all
function Update() local t = os.time() local freq = 30 if t >= tonumber(SKIN:GetVariable('One')) then print(tonumber(SKIN:GetVariable('One'))) SKIN:Bang('!Execute [!EnableMeasure "MeasureWebParser"][!Redraw]') SKIN:Bang('!SetVariable "One" "'..round(t+freq-(t%freq)+1)..'"') end end
-Brian
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Posts: 56
- Joined: December 27th, 2011, 12:32 pm
Re: Update Plugin Measure from LUA
Code: Select all
[MeasureWebParser]
Measure=Plugin
Plugin=WebParser
UpdateDivider=-1
UpdateRate=1
Url=http://slashdot.org/slashdot.rdf
Download=1
ForceReload=1
FinishAction=!CommandMeasure "MeasureScript" "Two()"
-
- Developer
- Posts: 2688
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: Update Plugin Measure from LUA
I knew I forgot something.smurfier wrote:Unless you set UpdateRate=1 in MeasureWebParser, it would not pull the website until 600 updates later.
Glad to see you got it working.prince1142003 wrote:That did the trick. Thanks!
-Brian