It is currently April 9th, 2020, 1:57 am

Add-on update notification function for feed skin

Tips and Tricks from the Rainmeter Community
User avatar
kenz0
Developer
Posts: 264
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Add-on update notification function for feed skin

Post by kenz0 »

This is the function that compares publish dates in the feed and executes some actions when the contents is updated.
You can easily add this function to any feed skin based on RSS or ATOM. (of course, Twitter and Gmail, too.)
  • The advantage of this way is a point that the function can be added without modifying original codes.
:: Usage ::

!! This method requires Rainmeter-1.3 beta or higher !!

Step1: Add following either code snippets to the end of original codes.

[for RSS feed]

Code: Select all

; Notification Sections ----------------------

[PUBDATE]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=<SiteURL>
UpdateRate=<UpdateRate>
RegExp="(?sU)<item>.*<pubDate>.*, (\d{2}) (\w{3}) \d{2}(\d{2}) (\d{2}):(\d{2}):(\d{2}) "

[DAY]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=1

[MONTH]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=2
Substitute="Jan":"01","Feb":"02","Mar":"03","Apr":"04","May":"05","Jun":"06","Jul":"07","Aug":"08","Sep":"09","Oct":"10","Nov":"11","Dec":"12"

[YEAR]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=3

[HOUR]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=4

[MINUTE]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=5

[SECOND]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=6

[CURRENT]
Measure=Calc
Formula=YEAR*10000000000+[MONTH]*100000000+DAY*1000000+HOUR*10000+MINUTE*100+SECOND
DynamicVariables=1

[SET]
Measure=Calc
Formula=CURRENT-#LASTUPDATE#
IfAboveValue=1
IfAboveAction=!Execute [!RainmeterSetVariable LASTUPDATE [CURRENT]]#ACTION#[!RainmeterWriteKeyValue "Variables" "LASTUPDATE" "[CURRENT]"]
DynamicVariables=1
[for ATOM feed]

Code: Select all

; Notification Sections ----------------------

[PUBDATE]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=<SiteURL>
UpdateRate=<UpdateRate>
RegExp="(?sU)<entry>.*<(?:updated|modified)>\d{2}(\d{2})\-(\d{2})\-(\d{2})T(\d{2}):(\d{2}):(\d{2})"

[YEAR]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=1

[MONTH]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=2

[DAY]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=3

[HOUR]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=4

[MINUTE]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=5

[SECOND]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[PUBDATE]
StringIndex=6

[CURRENT]
Measure=Calc
Formula=YEAR*10000000000+MONTH*100000000+DAY*1000000+HOUR*10000+MINUTE*100+SECOND

[SET]
Measure=Calc
Formula=CURRENT-#LASTUPDATE#
IfAboveValue=1
IfAboveAction=!Execute [!RainmeterSetVariable LASTUPDATE [CURRENT]]#ACTION#[!RainmeterWriteKeyValue "Variables" "LASTUPDATE" "[CURRENT]"]
DynamicVariables=1
Step2: Set the values in <SiteURL> and <UpdateRate> in [PUBDATE] section.
  • Of course, it's necessary to set the same values as original feed section as for these values.
Step3: Add the following 2 variables to [Variables] section.
  • If [Variables] section doesn't exist in original codes, you need to add it.

Code: Select all

ACTION=[PLAY notify.wav]
LASTUPDATE=0
  • In the above setting, the command that sounds the chime as a notification action is defined.
    However, you can define not only the chime but also any other actions in "ACTION" variable. (bracket [] is needed)
___________________________________________

:: Additional usage ::
The above method is a temporary solution that uses DynamicVariables, and it's impossible that this keeps a value of last update permanently.
So it always executes action at the time of starting skin whether the update is found or not.
However, you can make up for this fault by using NirCmd.
Add the following 2 steps if you need it.
Step4: Install NirCmd to somewhere. (e.g. "C:\Program Files\Rainmeter\Addons\nircmd\")

Step5: Change the command in [SET] section as follows.
[UPDATE 10.09.03]


* * * * * * * * * * * * * * * * * * * * * * * * * * *

I hope these informations are useful for your skin work.

___________________________________________

[UPDATE 10.09.03]
The above issue came to be solved by !RainmeterWriteKeyValue. You don't need NirCmd any more.
Last edited by kenz0 on September 4th, 2010, 7:13 am, edited 1 time in total.
.
Image