It is currently May 6th, 2024, 8:04 am

Webparser Not Downloading Image.

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Webparser Not Downloading Image.

Post by jsmorley »

Rainmeter does not hate Easy Company, Private Randleman. It just hates you.
Pyros_Enjoy_Pie
Posts: 7
Joined: August 2nd, 2017, 1:32 am

Re: Webparser Not Downloading Image.

Post by Pyros_Enjoy_Pie »

jsmorley wrote:Rainmeter does not hate Easy Company, Private Randleman. It just hates you.
I don't uhhh...I don't know what that means man.
User avatar
balala
Rainmeter Sage
Posts: 16200
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Not Downloading Image.

Post by balala »

Pyros_Enjoy_Pie wrote:Alright so I used jsmorley's code and got back an image of the coordinates that that particular website was giving. However those coordinates were wrong, so I decided I needed to use a different website. This one has a slightly different setup in its html (instead of getting lat and long separately they come paired and with a "," such that the string index comes out to be xx.xxxx,yy.yyyy) so I adjusted the RegExp to get the new numbers, changed [MeasureIP2Lat] & [MeasureIP2Long] to [MeasureIP2LatLong) to reflect that now its coming over as just one string index instead of two, changed the URL so its reading as [&MeasureIP2LatLong] (as the string index is now xx.xxxx,yy.yyyy) instead of [&MeasureIP2Lat],[&MeasureIP2Long]. I checked the log to make sure [MeasureIP2LatLong] is coming up as the coordinates which were in the html for the website, it is. But once again I have come to the problem of its not downloading the damn image. Here's my skin again new and shiny.
I think there happened something with the website: for neither the previously working skin doesn't want to work any more. Try it, to see if it is for you.
Pyros_Enjoy_Pie
Posts: 7
Joined: August 2nd, 2017, 1:32 am

Re: Webparser Not Downloading Image.

Post by Pyros_Enjoy_Pie »

balala wrote:I think there happened something with the website: for neither the previously working skin doesn't want to work any more. Try it, to see if it is for you.
I'm sorry, but I have no idea what you just said.
User avatar
balala
Rainmeter Sage
Posts: 16200
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Not Downloading Image.

Post by balala »

Pyros_Enjoy_Pie wrote:I'm sorry, but I have no idea what you just said.
I meant that I tried to load the code which previously worked for sure and it doesn't any more. That's why I think something is going on with the site.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Webparser Not Downloading Image.

Post by StArL0rd84 »

Hi all, this idea for a skin is awesome!
got it working great, but i wanna flesh it out a bit with zoom and pan functions.

And sorry for butting in here with my own little problem ;P
To start with, I am trying to calculate the next latitude.
But the calc measure i am using to do that with "shortens" the value.

57.0480003357 becomes 57.048
Just wondering why ( on earth :D ) the calc measure are doing that.

Code: Select all

[Rainmeter]
 Update=1000

[Variables]
 Zoom=12

[MeasureSiteAll]
 Measure=Plugin
 Plugin=WebParser
 URL=http://www.tell-my-ip.com/index.html
 RegExp=(?siU)<td.*>Your IP Address:</td><td>(.*)</td>.*<td>Country:</td>.*<img src="(.*)"> (.*)</td>.*<td>Region:</td><td>(.*)</td>.*<td>City:</td><td>(.*)</td>.*<td>Latitude:</td><td>(.*)</td>.*<td>Longitude:</td><td>(.*)</td>
 UpdateRate=1000
 FinishAction=[!CommandMeasure "MeasureMap" "Update"]
 
[MeasureIP2Lat]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 URL=[MeasureSiteAll]
 UpdateRate=1000
 StringIndex=6
 
 [MeasureIP2Lat2]
 Measure=String
 String=[MeasureIP2Lat]
 DynamicVariables=1
 
 [MeasureIP2Lat3]
 Measure=Calc
 Formula=MeasureIP2Lat2 + 1

[MeasureIP2Long]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 URL=[MeasureSiteAll]
 UpdateRate=1000
 StringIndex=7

[MeasureMap]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 URL="https://maps.googleapis.com/maps/api/staticmap?center=[&MeasureIP2Lat2],[&MeasureIP2Long]&size=640x400&zoom=#Zoom#&maptype=hybrid&markers=icon:http://i.imgur.com/MN9NZ6g.png%7C[&MeasureIP2Lat2],[&MeasureIP2Long]&format=png"
 Debug=1
 StringIndex=1
 Download=1
 DownloadFile="map.png"
 DynamicVariables=1
 FinishAction=[!UpdateMeter *][!Redraw]
 DynamicVariables=1

[MeterMap]
 MeasureName=MeasureMap
 Meter=IMAGE
 LeftMouseUpAction=[!SetOption MeasureIP2Lat2 String "[MeasureIP2Lat3]"][!CommandMeasure "MeasureMap" "Update"]
 MouseLeaveAction=[!HideMeterGroup Interface][!Redraw]
 MouseOverAction=[!ShowMeterGroup Interface][!Redraw]
 DynamicVariables=1
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
Pyros_Enjoy_Pie
Posts: 7
Joined: August 2nd, 2017, 1:32 am

Re: Webparser Not Downloading Image.

Post by Pyros_Enjoy_Pie »

So I rebooted my computer after going out for a bit and its now working. I guess it was like jsmorley was saying and the webparser was getting hung from me hammering the refresh button.

EDIT: If anyone ever comes across this and wants the code here it is

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
locationsub="":"0"

[MeasureSiteAll]
Measure=Plugin
Plugin=WebParser
URL=http://ipinfo.io/
RegExp=(?siU)<td data-loc="(.*)">
UpdateRate=1
ForceReload=1
FinishAction=[!UpdateMeasure MeasureMap][!CommandMeasure "MeasureMap" "Update"]

[MeasureIP2LatLong]
Measure=Plugin
Plugin=WebParser
URL=[MeasureSiteAll]
UpdateRate=1
Substitute=#locationsub#
StringIndex=1
ForceReload=1
FinishAction=[!UpdateMeasure MeasureMap][!CommandMeasure "MeasureMap" "Update"]

[MeasureMap]
Measure=Plugin
Plugin=WebParser
URL="https://maps.googleapis.com/maps/api/staticmap?center=[&MeasureIP2LatLong]&size=640x400&zoom=8&maptype=hybrid&markers=icon:http://i.imgur.com/MN9NZ6g.png%7C[&MeasureIP2LatLong]&format=png"
Download=1
DownloadFile="map.png"
ForceReload=1
DynamicVariables=1
FinishAction=[!UpdateMeter *][!Redraw]

[MeterMap]
MeasureName=MeasureMap
Meter=IMAGE
X=30
Y=31
It seems to get hung every now and then and doesn't seem to start working again unless you reboot. It is also using a constant for the zoom, so if you want to make that a variable you'd have to do that yourself. Finally the icon being used is an image that I have uploaded to imgur, feel free to use it, but you can find out how to get a Google Maps pin or your a custom icon on the Google Maps Static API developer website.
User avatar
balala
Rainmeter Sage
Posts: 16200
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Not Downloading Image.

Post by balala »

StArL0rd84 wrote:57.0480003357 becomes 57.048
Where are you seeing that 57.048? If you're talking about the value returned by the [MeasureIP2Lat3] measure, you have to be careful, because the values retuned by the WebParser plugin measures (eg by the [MeasureIP2Lat] measure) are in fact strings (even if they are practically numbers), while those returned by the Calc measures are numbers. To this last ones, on a String meter for example the NumOfDecimals option applies, and the default value of this option is 0.
Eg, the following meter:

Code: Select all

[MeterLat]
Meter=STRING
MeasureName=MeasureIP2Lat
MeasureName2=MeasureIP2Lat3
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1#CRLF#%2
NumOfDecimals=10
shows the values of those two measures (the difference between these two values is equal with 1) with 10 decimals (according to the NumOfDecimals option). If you remove the NumOfdecimals option of this meter, [MeasureIP2Lat3] will be shown without decimals, while [MeasureIP2Lat] will still have ten decimals (despite of the fact that now 0 decimals are set up), because the value returned by the WebParser measure isn't treated as a number, but as a string.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Webparser Not Downloading Image.

Post by StArL0rd84 »

Yes i was talking about the value returned by the [MeasureIP2Lat3] calc measure. (57.048)
I am aware that the value retrieved by the webparser is a string. (57.0480003357)

And the NumOfDecimals=10 in your [MeterLat] would correct the calc, but only on the meter side of things.

I really need to make calculations on the FULL number (57.0480003357) so i got to find a way to convert the sting numbers into something i can work with in the calc measure.

Have not come across a way to do this in the documentation, but maybe i missed it.
Sure would be neat if NumOfDecimals could be applied to calc measures as well.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Webparser Not Downloading Image.

Post by jsmorley »

StArL0rd84 wrote:Yes i was talking about the value returned by the [MeasureIP2Lat3] calc measure. (57.048)
I am aware that the value retrieved by the webparser is a string. (57.0480003357)

And the NumOfDecimals=10 in your [MeterLat] would correct the calc, but only on the meter side of things.

I really need to make calculations on the FULL number (57.0480003357) so i got to find a way to convert the sting numbers into something i can work with in the calc measure.

Have not come across a way to do this in the documentation, but maybe i missed it.
Sure would be neat if NumOfDecimals could be applied to calc measures as well.
I believe the full number is stored and used in calculations. It's just the String value that is truncated like that.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureCalc]
Measure=Calc
Formula=57.0480003357

[MeasureCalc2]
Measure=Calc
Formula=MeasureCalc + 0.0000000001

[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[MeasureCalc2:] [MeasureCalc2]
DynamicVariables=1
1.jpg
You do not have the required permissions to view the files attached to this post.