Hello Community,
this sounds quite trivial but I have not succeeded yet in getting it to work.
Some images are stored on an external web server. I would like to create skins that download them regularly and keep them displayed on the desktop. Sounds trivial!
To overcome the usual secure authenticated proxy problems that prevent the WebParser plugin from downloading the images (the "official" way),
I have found a method using a PowerShell script, you can actually invoke Powershell on the command line (the syntax is powershell.exe iwr -outf PATH_TO_LOCAL_TARGET_PNG https://PATH_TO_WWW_SOURCE_PNG). This works on the command line, the correct image gets downloaded to the correct place.
So... how do you write a correct Rainmeter skin that will invoke the PowerShell command regularly (e.g. every 15mins) to save the image to #@#/myimage.png and keep a MeterImage up to date displaying that file?
I have tried various strategies using Measure=Plugin, Plugin=RunCommand, OnUpdateAction in the MeterImage section, etc, but nothing seems to happen, the command ends up never being launched in my scripts. Then there is no image to display and nothing happens.
Thanks in advance if anyone can suggest a skeleton script that works!
It is currently April 25th, 2024, 6:30 am
running a program to update an MeterImage
-
- Posts: 8
- Joined: December 4th, 2017, 5:37 pm
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: running a program to update an MeterImage
It would be much easier for us to help you, if we would know the PATH_TO_WWW_SOURCE_PNG. Could you please post it?
-
- Posts: 8
- Joined: December 4th, 2017, 5:37 pm
Re: running a program to update an MeterImage
Hi balala
thank you for your reply,
unfortunately I cannot share the real link but here is a test image that is exactly in the same style of setup:
https://storage.googleapis.com/trdemo/testimage.png
if you need the contents of the image to be made to change regularly I can rig this up but may need a couple of days.
Thanks!
thank you for your reply,
unfortunately I cannot share the real link but here is a test image that is exactly in the same style of setup:
https://storage.googleapis.com/trdemo/testimage.png
if you need the contents of the image to be made to change regularly I can rig this up but may need a couple of days.
Thanks!
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: running a program to update an MeterImage
This testimage is downloaded by Rainmeter with no problem. Doesn't this work with the original source?medvejonok wrote:https://storage.googleapis.com/trdemo/testimage.png
An example code:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureImage]
Measure=Plugin
Plugin=WebParser
Url=https://storage.googleapis.com/trdemo/testimage.png
Download=1
UpdateRate=1800
[MeterImage]
Meter=Image
MeasureName=MeasureImage
-
- Posts: 8
- Joined: December 4th, 2017, 5:37 pm
Re: running a program to update an MeterImage
No, unfortunately I am behind an authenticated proxy, so cannot use the WebParser plugin.
The solution would be to run
powershell.exe iwr -outf PATH_TO_LOCAL_TARGET_PNG https://PATH_TO_WWW_SOURCE_PNG
every time the image needs refreshing
I have not succeeded in getting Rainmeter to run this, and to use this command to refresh and reload the image to be displayed.
The solution would be to run
powershell.exe iwr -outf PATH_TO_LOCAL_TARGET_PNG https://PATH_TO_WWW_SOURCE_PNG
every time the image needs refreshing
I have not succeeded in getting Rainmeter to run this, and to use this command to refresh and reload the image to be displayed.
-
- Posts: 8
- Joined: December 4th, 2017, 5:37 pm
Re: running a program to update an MeterImage
I suppose ultimately if rainmeter cannot do this, I could use a scheduler to run the powershell script independently, and then get rainmeter to just display the local image?
However it would be much better if this could all be bundled in the same skin to avoid the image download running when it is not necessary because the skin is not running either.
However it would be much better if this could all be bundled in the same skin to avoid the image download running when it is not necessary because the skin is not running either.
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: running a program to update an MeterImage
Yeah, you could, however Rainmeter can use the described method to download the image. See the following code:medvejonok wrote:I suppose ultimately if rainmeter cannot do this, I could use a scheduler to run the powershell script independently, and then get rainmeter to just display the local image?
Code: Select all
[Rainmeter]
Update=-1
[Variables]
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter=iwr -outf PATH_TO_LOCAL_TARGET_PNG https://PATH_TO_WWW_SOURCE_PNG
State=Hide
[MeterDownload]
Meter=STRING
MeasureName=MeasureRun
X=50
Y=20
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=14
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=Click to#CRLF#download
LeftMouseUpAction=[!CommandMeasure "MeasureRun" "Run"]
The code, through the [MeasureRun] plugin measure, downloads the image, using the PowerShell. Yet it does the download only when you're clicking the Click to download string. Please try this code and let me know if it works. If it does, we'll furtherly develop it, to make it to work as you want.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: running a program to update an MeterImage
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureGetImage "Run"]
[Variables]
InImage=https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-596635.jpg
OutImage=#CURRENTPATH#DownloadedImage.png
[MeasureGetImage]
Measure=Plugin
Plugin=RunCommand
Parameter=powershell.exe iwr -outf "#OutImage#" "#InImage#"
FinishAction=[!SetOption MeterImage ImageName "#OutImage#"][!UpdateMeter MeterImage]
[MeterImage]
Meter=Image
W=400
PreserveAspectRatio=1
You do not have the required permissions to view the files attached to this post.
-
- Posts: 8
- Joined: December 4th, 2017, 5:37 pm
Re: running a program to update an MeterImage
Many thanks to both of you, this support is so helpful!
This helps resolve the question of authenticated proxies not working with Webparser plugin. Thanks again.
This helps resolve the question of authenticated proxies not working with Webparser plugin. Thanks again.
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: running a program to update an MeterImage
Glad to help, if you got it working well.medvejonok wrote:Many thanks to both of you, this support is so helpful!
This helps resolve the question of authenticated proxies not working with Webparser plugin. Thanks again.