It is currently April 16th, 2024, 4:54 pm

[Solved] How to use ActionTimer

Get help with creating, editing & fixing problems with skins
knotfinley
Posts: 8
Joined: April 7th, 2017, 2:38 pm

[Solved] How to use ActionTimer

Post by knotfinley »

Hello,
Trying to access URL to get timezone offset but site blocks if more than 1 request per second. I want delay of 5 or 10 seconds between Msloc1 and MsLoc2. I tried ActionTimer but I'm not getting wait. What am I doing wrong or is there a better way.

Code: Select all

[Variables]
W=100000
Loc1=America/Los_Angeles
Loc2=America/Denver
DnLoc1=pacific.txt
DnLoc2=denver.txt

[MeasureSizeUp]
Measure=Plugin
Plugin=ActionTimer
UpdateRate=7200
ActionList1=RunLoc1 | Wait #W# | RunLoc2 
RunLoc1=[!UpdateMeasure MsLoc1]
RunLoc2=[!UpdateMeasure MsLoc2]
DynamicVariables=1


[MsLoc1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
url=http://api.timezonedb.com/v2/get-time-zone?key=here&format=json&by=zone&zone=#Loc1#
Download=1
DownloadFile=#DnLoc1#

[MsLoc2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
url=http://api.timezonedb.com/v2/get-time-zone?key=here&format=json&by=zone&zone=#Loc2#
Download=1
DownloadFile=#DnLoc2#
Last edited by knotfinley on April 14th, 2017, 1:47 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to use ActionTimer

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureDelayer "Execute 1"]

[Variables]
W=10000
Loc1=America/Los_Angeles
Loc2=America/Denver
DnLoc1=pacific.txt
DnLoc2=denver.txt

[MeasureDelayer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=RunLoc1 | Wait #W# | RunLoc2 
RunLoc1=[!EnableMeasure MsLoc1][!CommandMeasure MsLoc1 "Update"]
RunLoc2=[!EnableMeasure MsLoc2][!CommandMeasure MsLoc2 "Update"]
DynamicVariables=1

[MsLoc1]
Measure=Plugin
Plugin=WebParser
Group=Zones
url=http://api.timezonedb.com/v2/get-time-zone?key=here&format=json&by=zone&zone=#Loc1#
Disabled=1
Download=1
DownloadFile=#DnLoc1#

[MsLoc2]
Measure=Plugin
Plugin=WebParser
Group=Zones
url=http://api.timezonedb.com/v2/get-time-zone?key=here&format=json&by=zone&zone=#Loc2#
Disabled=1
Download=1
DownloadFile=#DnLoc2#
FinishAction=[!DisableMeasureGroup Zones]

[MeterDummy]
Meter=String
This should work for the "timing" you are looking for. I get back the two files, one right away and one in 10 seconds (10000 milliseconds). They are both an error message for me, with "invalid API", but that's a different issue.

So what we are doing is:

When the skin is loaded or refreshed, we kick off the ActionTimer plugin in [MeasureDelayer].
What that does is first enable the measure [MsLoc1] We don't want the WebParser measures to be updated on their own, we want them to be asleep unless we tell them to fire.
Then we force an update of [MsLoc1] to get the first download.
Then we wait 10 seconds (10000 milliseconds).
Then we enable and force update the second WebParser measure [MsLoc2].

When [MsLoc2] is "finished", it forces both WebParser measure back to sleep. One, we don't want them firing again one after the other, or we get the error you encountered. Second, the results are presumably never going to change, so what is the point of hammering the site. You just need it once.
knotfinley
Posts: 8
Joined: April 7th, 2017, 2:38 pm

Re: [Solved] How to use ActionTimer

Post by knotfinley »

Hello,

This skin was for update DST for a clock skin. Since it doesn't need to run very often, 4 times a year for North America and Europe, I added a button to my clock skin that !ActivateConfig skin Offset.ini and the finish action in skin Offset.ini is !DeactivateConfig. Works perfectly and only used when needed.

Thanks for your help getting me here.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Solved] How to use ActionTimer

Post by jsmorley »

Glad to help.