It is currently May 7th, 2024, 10:29 pm

Update notifier in skin

Get help with creating, editing & fixing problems with skins
User avatar
Kirito
Posts: 4
Joined: January 19th, 2013, 3:27 pm
Location: Ireland

Update notifier in skin

Post by Kirito »

ok umm hello everyone, im new here but have so far made 2 very simple skins (they are on my deviant page), the question i have is one of my skins, i add updates every now and again and re release it as a new version, 1.1, 1.2, 1.3 , what im wondering is, can i add a feature that will (like the gmail notifier skin) keep an eye on the deviant page where i post the updates, whatch the number in the name, say like skin ver 1.1, if 1.1 is higher than its own version it will pop up a message to the user and let them know there is a new version??

any help would be appreciated, im new to coding my own skins and still have alot to learn, any help or advice would be much appreciated, currently im trying to study the rss features and webparser options to learn how they fully work.
Art is the ultimate sense of freedom, u cant learn art like u do science, instead learn and adapt it to what u like and what feels best
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Update notifier in skin

Post by jsmorley »

Yes, you will need to use WebParser to accomplish this.

What I would do is some variant of:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
Version=1.0

[MeasureVersion]
Measure=Plugin
Plugin=WebParser
URL=http://jsmorley.deviantart.com/art/JSWeather-2-0-339282232
RegExp="(?siU)<meta name="description" content="\[Version: (.*)\]"
StringIndex=1
FinishAction=!EnableMeasure CheckVersion

[CheckVersion]
Measure=Calc
Formula=MeasureVersion > #Version# ? 1 : 0
IfEqualValue=1
IfEqualAction=!ShowMeter MeterOldVersion
Disabled=1

[MeterOldVersion]
Meter=String
FontSize=12
FontColor=168,59,61,255
SolidColor=0,0,0,1
StringStyle=Bold
AntiAlias=1
Text=Your skin version is out of date!#CRLF#Click here to get new version
LeftMouseUpAction=["http://jsmorley.deviantart.com/art/JSWeather-2-0-339282232"]
Hidden=1
What this is doing is:

I put an entry in the comments in my deviation that can easily be parsed, containing the version number.

http://jsmorley.deviantart.com/art/JSWeather-2-0-339282232
Note: I personally would not use the "name" of the deviation for this, as not having a consistent URL for WebParser to use is going to just complicate things and mean something else you have to change when you update the skin.

I then use WebParser to check the HTML source of the page, looking for the pattern "[Version: x]" where "x" is the version number. I capture that number.

When WebParser is finished getting the data from the site and parsing it, I have FinishAction enable a Calc measure that checks the number returned against a [Variable] "Version" set in the skin.

If the value of the new version is greater than the old one in the [Variable], I show a hidden meter that complains and offers a link to the deviation.

When the deviation is downloaded and the .rmskin is run, the new version has the updated [Variable] "Version", and the check takes no action unless it again changes in the future.
User avatar
Kirito
Posts: 4
Joined: January 19th, 2013, 3:27 pm
Location: Ireland

Re: Update notifier in skin

Post by Kirito »

thank you very much, thats exactly what i need, much appreciated, ill make sure to add credit in the skins update, thank you very much, im really enjoying rainmeter and whats its capable of doing haha, :)
Art is the ultimate sense of freedom, u cant learn art like u do science, instead learn and adapt it to what u like and what feels best
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Update notifier in skin

Post by jsmorley »

Glad to help.