When any application (or skin) wants to know if there is a newer version, it has to look to a server somewhere on the Internet with information about the latest release. Although I maintain my own Web and FTP servers from my home network, I didn't want to put the version lookup server there since I can't guarantee it is up most of the time. The breakthrough came when I realized I could embed the latest version number on my deviantART gallery page, and use WebParser to extract it.
To start, embed the latest version number for your skin in the TITLE of your skin page in your deviantART gallery. Do this in a way that allows you to find it with a WebParser measure. For my multiFEED skin I set the title to the form "multiFEED RSS/Atom Feed Skin v0.0.0"
Next, define a measure to parse the version number for your skin from your gallery web page.
Code: Select all
[MeasureLatestVersion]
Measure=Plugin
Plugin=WebParser
URL="#DeviantARTpage#"
RegExp="(?siU)multiFEED.+([0-9]+\.[0-9]+\.[0-9]+)"
StringIndex=1
UpdateDivider=#UpdateCheckInterval#
With this measure you have everything you need to compare the current skin version with the latest one. You could pop up a child skin in response to a user request for an update check, but I chose a different method that unobtrusively monitors for updates and alerts the user automatically without their intervention.
First I created a small 16x16 PNG icon with a bright Alert/Warning image. Then I converted it to B&W and saved it under a different name. I named them Alert0.png and Alert1.png (you'll see why below). Next I created a timer than alternates between zero and one just under once per second.
Code: Select all
[MeasureAlertFlasher]
Measure=Calc
Formula="(MeasureAlertFlasher=1)?0:1"
UpdateDivider=7
Code: Select all
[MeterUpdateAlert]
Meter=Image
MeasureName=MeasureAlertFlasher
MeasureName2=MeasureLatestVersion
ImageName=#CURRENTPATH#Alert%1.png
ToolTipText="New Version Available (%2). Click here to download it."
Hidden=1
LeftMouseUpAction="#DeviantPage#"
Code: Select all
[MeasureLatestVersion]
..
..
FinishAction=[!SetOption MeterUpdateAlert Hidden "([*MeasureHideNewVersionAlert*])"]
Code: Select all
--HideNewVersionAlert.lua
function Update()
LatestVersion = SKIN:GetMeasure('MeasureLatestVersion'):GetStringValue()
CurrentVersion = SKIN:GetVariable('Version')
if (CurrentVersion=="" or CurrentVersion==LatestVersion) then
return 1
else
return 0
end
end -- function Update
Code: Select all
[MeasureHideNewVersionAlert]
Measure=Script
ScriptFile=#CURRENTPATH#HideNewVersionAlert.lua
That's it! Your skin will now alert the user if there is a new version available, and take them directly to your deviantART gallery to download it if they click on the flashing alert. Of course, you could embed the latest skin version number on any web page you have control over, not just your deviantART gallery. If you can define the actual HTML for the page, you can even hide the version number in metadata so the viewer won't see it.
Hope this proves useful as you build and publish your new skins.
Slarti