Ok, thanks.
It is currently April 19th, 2024, 12:47 am
Why WebParser Download Stops Working?
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
I think the key to that may be the C#-based System.Net.WebClient, which is likely a slightly more robust animal than the C++ WinINet API calls used in WebParser.
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Why WebParser Download Stops Working?
No comment for my part. Have no idea...
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
Skin just a bit shorter, and a test in the Powershell to avoid an unwanted log message.
GetMoon.ini
GetMoon.ps1:
No need for the separate Calc measure to execute the RunCommand. That measure can execute itself based on UpdateDivider.
GetMoon.ini
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
URL=https://static.die.net/moon/800.jpg
[MeasureGetMoon]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Program=PowerShell.exe
Parameter=-NoProfile -ExecutionPolicy Bypass -Command "& '.\GetMoon.ps1' '#URL#' '.\Moon.jpg'"
UpdateDivider=600
OnUpdateAction=[!CommandMeasure #CURRENTSECTION# "Run"]
FinishAction=[!SetOption MeterShowMoon ImageName "Moon.jpg"][!UpdateMeter MeterShowMoon][!Redraw]
[MeterContainer]
Meter=Shape
Shape=Ellipse 100,100,96 | StrokeWidth 0
[MeterShowMoon]
Meter=Image
Path=#CURRENTPATH#
W=200
PreserveAspectRatio=1
Container=MeterContainer
Code: Select all
$url = $args[0]
$file = $args[1]
if (Test-Path $file)
{
Remove-Item $file
}
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $file)
No need for the separate Calc measure to execute the RunCommand. That measure can execute itself based on UpdateDivider.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 75
- Joined: December 15th, 2018, 3:35 am
Re: Why WebParser Download Stops Working?
I implemented this method and it worked like a charm!jsmorley wrote: ↑December 16th, 2018, 12:59 am Skin just a bit shorter, and a test in the Powershell to avoid an unwanted log message.
GetMoon.iniGetMoon.ps1:Code: Select all
[Rainmeter] Update=1000 DynamicWindowSize=1 AccurateText=1 [Variables] URL=https://static.die.net/moon/800.jpg [MeasureGetMoon] Measure=Plugin Plugin=RunCommand OutputType=ANSI Program=PowerShell.exe Parameter=-NoProfile -ExecutionPolicy Bypass -Command "& '.\GetMoon.ps1' '#URL#' '.\Moon.jpg'" UpdateDivider=600 OnUpdateAction=[!CommandMeasure #CURRENTSECTION# "Run"] FinishAction=[!SetOption MeterShowMoon ImageName "Moon.jpg"][!UpdateMeter MeterShowMoon][!Redraw] [MeterContainer] Meter=Shape Shape=Ellipse 100,100,96 | StrokeWidth 0 [MeterShowMoon] Meter=Image Path=#CURRENTPATH# W=200 PreserveAspectRatio=1 Container=MeterContainer
Code: Select all
$url = $args[0] $file = $args[1] if (Test-Path $file) { Remove-Item $file } $wc = New-Object System.Net.WebClient $wc.DownloadFile($url, $file)
1.png
GetImage_3.0.rmskin
No need for the separate Calc measure to execute the RunCommand. That measure can execute itself based on UpdateDivider.
Thank you very much.
Issue solved!
Last edited by GTI.H on December 23rd, 2018, 8:33 pm, edited 1 time in total.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
-
- Posts: 75
- Joined: December 15th, 2018, 3:35 am
Re: Why WebParser Download Stops Working?
There was one thing missing:
Since OnDownloadErrorAction does not work in Measure MeasureGetMoon, how to detect Download error in Measure MeasureGetMoon?
I tried my old trick
and it did not work.
Since OnDownloadErrorAction does not work in Measure MeasureGetMoon, how to detect Download error in Measure MeasureGetMoon?
I tried my old trick
Code: Select all
IfMatchMode=1
IfMatch=.*\w+
IfNotMatchAction=[!Log "Not Match"]
IfMatchAction=[!Log "Match"]
-
- Posts: 40
- Joined: October 26th, 2016, 5:00 pm
Re: Why WebParser Download Stops Working?
IfMatch = .+GTI.H wrote: ↑December 23rd, 2018, 3:26 am There was one thing missing:
Since OnDownloadErrorAction does not work in Measure MeasureGetMoon, how to detect Download error in Measure MeasureGetMoon?
I tried my old trick
and it did not work.Code: Select all
IfMatchMode=1 IfMatch=.*\w+ IfNotMatchAction=[!Log "Not Match"] IfMatchAction=[!Log "Match"]
-
- Posts: 75
- Joined: December 15th, 2018, 3:35 am
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Why WebParser Download Stops Working?
Try the followings: first remove the above set of IfMatch options from the [MeasureGetMoon] measure, then add the following String measure to your code:
Code: Select all
[MeasureGetMoonResult]
Measure=String
String=[MeasureGetMoon]
IfMatch=^$
IfNotMatchAction=[!Log "Error"]
IfMatchAction=[!Log "No error"]
DynamicVariables=1
UpdateDivider=-1
Disabled=1