This is a little helper app you can put in your skin folder (or anywhere really) which allows you do download images retrieved by WebParser.dll without some of the limitations of "Download=1". I have included a sample skin .ini file to demonstrate its use.
Here is the Image.ini file so you can check the documentation and use before you download it and give it a try:
GetWebImage.exe was written by me in AutoIt3, and will work on XP/Vista/Seven. You will need to set it to run as "Administrator" on Vista/Seven if you have UAC turned on and are saving the image anywhere in "C:\Program Files".
Code: Select all
;=========================================================================== ; Rainmeter configuration file ; Updated June 26, 2009 ; ; This sample skin demonstrates the use of ; GetWebImage.exe by Jeffrey Morley ; ; The format for GetWebImage.exe is: ; "FullPath\GetWebImage.exe" "http://URL/ImageToGet" "NameToSaveAs.ext" ; ; "URL" is the full URL and path to the image: "http://pics.com/images/" ; ; Using this program has the following advantages over "Download=1" on ; a WebParser "Measure" ; ; 1) The image is stored wherever you specify, not as a "temporary" ; file, so it can be used repeatedly in a skin on multiple meters. ; 2) If you have a website or RSS feed (like News.Google) which ; displays different images, with a different location but the same ; image name, this will allow you to download those multiple images ; without the same name causing the second image to overwrite the first. ; 3) The image you download is stored where you specify, and can be ; used for other purposes, rather than being deleted as is the ; case with WebParser's "Download=1". ; ; Using this program has ONE disadvantage however, and this should ; be considered when deciding to use this or just "Download=1". ; ; 1) The "FinishAction" command in Rainmeter ONLY fires on a WebParser ; measure which has a "RegExp=" statement. So if you need to ; download multiple images in one skin, you will have to "go back" ; to the website to retrieve each image. You cannot use this ; program with a WebParser measure which "references" another ; WebParser measure and just uses "StringIndex=x" to get the result. ; I have an example of what WON'T work at the bottom of this skin. ;=========================================================================== ;[BEGIN CONFIG FILE]======================================================== [Variables] RootURL="http://www.rainmeter.net/forum/" GetWebImageExe="C:\Program Files\Rainmeter\Skins\GetImage\GetWebImage.exe" [MeasureDL] Measure=Plugin Plugin=Plugins\WebParser.dll UpdateRate=1800 Url=#RootURL# RegExp="(?siU)id="logo"><img src="(.*)"/>.*" StringIndex=1 FinishAction=!execute ["#GetWebImage#" "#RootURL#[MeasureDL]" "DownloadedImage.png"] ; ; NOTE - If the HTML dispays the image with the full URL/image.png instead of ; a "relative" path like this example, you can return the whole thing in ; StringIndex 1, and just leave off the #RootURL# in the command as it will ; already be in the result returned in StringIndex 1. ; [MeterImage] Meter=IMAGE ImageName="DownloadedImage.png" X=0 Y=0 ;[END CONFIG FILE]=================================================================== ;[WHAT WE JUST DID]================================================================== ; ; The full URL, path and name of the image we wanted to retrieve is: ; ; http://www.rainmeter.net/forum/styles/saphic/imageset/site_logo.png ; ; So the #RootUrL" is "http://www.rainmeter.net/forum/" ; ; And it is found in the source HTML as: ; ; <a href="./index.php" title="Board index" id="logo"><img src="./styles/saphic/imageset/site_logo.png"/></a> ; ; So we used our RegExp to retrieve ./styles/saphic/imageset/site_logo.png ; ; If you put the #RootURL# together with the information retrieved into StringIndex 1, you have: ; ; http://www.rainmeter.net/forum/./styles/saphic/imageset/site_logo.png ; ; This is passed to GetWebImage.exe with "#RootURL#[MeasureDL]" in the "FinishAction" statement ; ; GetWebImage.exe downloads the image, and stores it as "DownloadedImage.png". It will be ; stored in the current directory in this example, but you can specify a full path if desired. ;[WHAT WON'T WORK]============================================================================== ; ; [MeasureDL] ; Measure=Plugin ; Plugin=Plugins\WebParser.dll ; UpdateRate=1800 ; Url=#RootURL# ; RegExp="(?siU)id="Image1"><img src="(.*)"/>.*id="Image2"><img src="(.*)"/>" ; ; [MeasureImage1] ; Measure=Plugin ; Plugin=Plugins\WebParser.dll ; UpdateRate=1800 ; Url=[MeasureDL] ; StringIndex=1 ; FinishAction=!execute ["#GetWebImage#" "#RootURL#[MeasureImage1]" "DownloadedImage1.png"] ; ; [MeasureImage2] ; Measure=Plugin ; Plugin=Plugins\WebParser.dll ; UpdateRate=1800 ; Url=[MeasureDL] ; StringIndex=2 ; FinishAction=!execute ["#GetWebImage#" "#RootURL#[MeasureImage2]" "DownloadedImage2.png"] ; ; Unfortunately Rainmeteter will NOT fire the "FinishAction" commands on a measure without ; a "RegExp=" statement so you would need two separate measures which go to the web site ; and get one image each in StringIndex=1. There may be a way around this with having ; the measures "MeasureImage1" and "MeasureImage2" use a RegExp= statement to "search" ; the results of StringIndex "0" of "MeasureDL" instead of using StringIndex=1, StringIndex=2. ; Feel free to give that a try and let me know if it works! ;
Here is the full AutoIt3 source code for GetWebImage.exe
Not a lot of code for a lot of functionality!
Code: Select all
#include <array.au3> If $CmdLine = 0 Then Exit EndIf InetGet($CmdLine,$CmdLIne,1) Exit