It is currently April 25th, 2024, 10:07 am

Scaling and placing an image

Get help with creating, editing & fixing problems with skins
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Scaling and placing an image

Post by qwerky »

Oops... we were posting at the same time... :Whistle now I'll go back and read your posts. :welcome:
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Scaling and placing an image

Post by jsmorley »

WebParser is not only the best way to download the images, it's really the only way.

You can re-use a single WebParser measure to do the downloading, assuming you are doing them one at a time. You just need to

1) Use !SetOption to change / set the URL option on the WebParser measure.
2) Use [!CommandMeasure MeasureName "Update"] to force the WebParser measure to go back out to the internet, which it will do using the new URL.

But think it through. Doing this will entirely replace the first image you download with the second as far as the skin is concerned.
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Scaling and placing an image

Post by qwerky »

Oh, I must be really dense, as I just can't get it to work. I've commented all the msrSatImageX measures, and both of the ImageSize plugin measures, and yet I still get "ImageSize.dll: File error for " in the log two times on every refresh.

The remaining code is:

Code: Select all

[msrSatRotate]
Measure=Calc
UpdateDivider=-1
Formula=(msrSatRotate%#SatURLs#)+1
DynamicVariables=1
OnUpdateAction=[!SetOption msrSatImage URL "#SatURL[*&msrSatRotate*]#"][!CommandMeasure msrSatImage "Update"]
;OnUpdateAction=[!SetOption msrSatImage URL "#SatURL[*&msrSatRotate*]#"][!UpdateMeasure msrSatImage]

[msrSatImage]
Measure=WebParser
;URL=#SatURL1#
UpdateRate=#SiteUpdateRate#
Download=1
DynamicVariables=1
FinishAction=[!UpdateMeter mtrSatImage]

[mtrSatImage]
Meter=Image
MeasureName=msrSatImage
X=(#skinRight#-1-#thumbWidth#)
Y=#iconY#
W=#thumbWidth#
H=#thumbHeight#
PreserveAspectRatio=1
DynamicVariables=1
MouseOverAction=[!SetOption mtrSatImage X "(#skinRight#-1-#imageWidth#)"][!SetOption mtrSatImage W "#imageWidth#"]
MouseLeaveAction=[!SetOption mtrSatImage X "(#skinRight#-1-#thumbWidth#)"][!SetOption mtrSatImage W "#thumbWidth#"]
LeftMouseUpAction=[!UpdateMeasure msrSatRotate]
I don't understand the difference between [!CommandMeasure msrSatImage "Update"] and [!UpdateMeasure msrSatImage], but have tried both. In About, msrSatImage is always empty, and msrSatRotate is 1.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Scaling and placing an image

Post by jsmorley »

I need the whole skin and any include files, or at least enough of it that I can paste it in a .ini file and run it. I just can't help if I can't test.

Feel free to pare it down to just what you are having trouble with, but be sure that if I paste that code into a skin file, it runs... It has none of those #Variables# defined, so it's just a blizzard of fail.
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Scaling and placing an image

Post by qwerky »

jsmorley wrote: February 18th, 2019, 12:33 am I need the whole skin and any include files, or at least enough of it that I can paste it in a .ini file and run it. I just can't help if I can't test.

Feel free to pare it down to just what you are having trouble with, but be sure that if I paste that code into a skin file, it runs... It has none of those #Variables# defined, so it's just a blizzard of fail.
Okay, here it is, pared down. :D But it does run. When clicking on the thumbnail, the msrSatRotate measure does count correctly, but the image does not change. If the OnUpdateAction line is uncommented, then no image appears. :?
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Scaling and placing an image

Post by jsmorley »

I think you are close.

Try this:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
OnRefreshAction=[!Move #skinX# #skinY#]

[Variables]
WorkingWidth=#WORKAREAWIDTH#
ScreenBorder=4
skinX=#ScreenBorder#
skinY=#ScreenBorder#
skinWidth=(#WorkingWidth#-(#ScreenBorder#*2))
skinHeight=160
skinRight=(#skinWidth#-1)
skinBottom=(#skinHeight#-1)
titlebarHeight=32
mainPanelHeight=(#skinHeight#-#titlebarHeight#)
mainPanelTop=#titlebarHeight#
mainPanelBottom=#skinBottom#
endPanelWidth=287
thumbWidth=(#endPanelWidth#-125)
thumbHeight=(#mainPanelHeight#-2)
imageWidth=900
iconY=(#mainPanelTop#+1)
SatURL1=https://weather.gc.ca/data/satellite/goes_nam_1070x_100.jpg
SatURL2=https://weather.gc.ca/data/satellite/goes_nam_visiblex_100.jpg
SatURL3=https://weather.gc.ca/data/satellite/goes_nam_1070_100.jpg
SatURL4=https://weather.gc.ca/data/satellite/goes_nam_vvi_100.jpg
SatURL5=https://weather.gc.ca/data/satellite/goes_ecan_vvi_100.jpg
SatURL6=https://weather.gc.ca/data/satellite/goes_enam_vvi_100.jpg
SatURLs=6
SiteUpdateRate=20

[msrSatRotate]
Measure=Calc
UpdateDivider=-1
Formula=(msrSatRotate%#SatURLs#)+1
DynamicVariables=1
OnUpdateAction=[!SetOption msrSatImage URL "#SatURL[&msrSatRotate]#"][!CommandMeasure msrSatImage "Update"]

[msrSatImage]
Measure=WebParser
URL=#SatURL1#
UpdateRate=#SiteUpdateRate#
Download=1
DynamicVariables=1
FinishAction=[!UpdateMeter mtrSatImage]

[mtrBackground]
Meter=Image
X=0
Y=0
W=#skinWidth#
H=#skinHeight#
SolidColor=0,16,64,255

[mtrTitleBar]
Meter=Image
X=0
Y=0
W=#skinWidth#
H=#titlebarHeight#
SolidColor=0,64,192,255

[mtrSatImage]
Meter=Image
MeasureName=msrSatImage
X=(#skinRight#-1-#thumbWidth#)
Y=#iconY#
W=#thumbWidth#
H=#thumbHeight#
PreserveAspectRatio=1
DynamicVariables=1
;MouseOverAction=[!SetOption mtrSatImage X "(#skinRight#-1-#imageWidth#)"][!SetOption mtrSatImage W "#imageWidth#"]
;MouseLeaveAction=[!SetOption mtrSatImage X "(#skinRight#-1-#thumbWidth#)"][!SetOption mtrSatImage W "#thumbWidth#"]
LeftMouseUpAction=[!UpdateMeasure msrSatRotate]
I added the variable SiteUpdateRate=20, so it isn't trying to hit the web every zero seconds... That would be spectacularly unsuccessful.
I removed the *escapes* from the action where you had them, as they are not needed, and just confuse WebParser. You really can't embed escapes inside of nested variables that way. I'd have to chew on it, but I won't, as they aren't needed...
I put back the OnUpdateAction.
I removed the mouse over actions temporarily, as I have no idea what they are doing other than making the image jump around.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Scaling and placing an image

Post by jsmorley »

So now, the difference between [!UpdateMeasure MyWebMeasure] and [!CommandMeasure MyWebMeasure "Update"]

The way WebParser works is that it has an internal counter, let's call it Ratey McRateFace. ...or maybe UpdateRateLoop.

What that says is "I should go out to the internet and get stuff when UpdateRateLoop is equal to zero".

It starts at zero when the skin is loaded or refreshed.

Each time the measure is updated, the UpdateRateLoop counter is incremented by 1.

When the UpdateRateLoop counter in the plugin hits the value you set for UpdateRate on the measure, it resets to zero, and starts over. In the meantime, it goes out to the internet and gets stuff.

That is why, when you have Update=1000 on the skin, and UpdateRate=600 on a WebParser measure, it is "fired" every 10 minutes.

So if you use [!UpdateMeasure MyWebMeasure] on it, that will increment UpdateRateLoop by 1... You still have 598 to go, right?

If you use [!CommandMeasure MyWebMeasure "Update"] on it, that will override UpdateRateLoop, set it immediately to zero, and off you go.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Scaling and placing an image

Post by jsmorley »

Ok, FYI, I updated the ImageSize plugin so it will properly react to Disabled and Paused settings on it.

You can get it here:

https://forum.rainmeter.net/viewtopic.php?f=127&t=18822#p101884

And it will now work like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureLogo]
Measure=WebParser
URL=https://forum.rainmeter.net/styles/elegance/theme/images/logo.png
Download=1
FinishAction=[!EnableMeasureGroup ImageSizes][!UpdateMeasureGroup ImageSizes]

[MeasureWidth]
Measure=Plugin
Plugin=ImageSize
Group=ImageSizes
ImageName=[MeasureLogo]
Dimension=Width
DynamicVariables=1
Disabled=1
UpdateDivider=-1

[MeasureHeight]
Measure=Plugin
Plugin=ImageSize
Group=ImageSizes
ImageName=[MeasureLogo]
Dimension=Height
DynamicVariables=1
Disabled=1
UpdateDivider=-1

[MeterSize]
Meter=String
MeasureName=MeasureWidth
MeasureName2=MeasureHeight
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Width: %1 | Height: %2

This eliminates the error(s) in the log when you use the plugin with WebParser.
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Scaling and placing an image

Post by qwerky »

jsmorley wrote: February 18th, 2019, 7:18 pm Ok, FYI, I updated the ImageSize plugin so it will properly react to Disabled and Paused settings on it.

You can get it here:

https://forum.rainmeter.net/viewtopic.php?f=127&t=18822#p101884
Thanks. I downloaded and installed the skin to update the plugin, and made sure Disabled=1 is on my two ImageSize measures, but I am still getting the two initial errors in the log when refreshing my skin.

In my \Skins\@Vault\Plugins\ImageSize\ directory, both versions 3.0 and 4.0 are there. Is there some way to tell which version is being used by my skin?
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Scaling and placing an image

Post by qwerky »

jsmorley wrote: February 18th, 2019, 1:58 am So now, the difference between [!UpdateMeasure MyWebMeasure] and [!CommandMeasure MyWebMeasure "Update"]

The way WebParser works is that it has an internal counter, let's call it Ratey McRateFace. ...or maybe UpdateRateLoop.

What that says is "I should go out to the internet and get stuff when UpdateRateLoop is equal to zero".

It starts at zero when the skin is loaded or refreshed.

Each time the measure is updated, the UpdateRateLoop counter is incremented by 1.

When the UpdateRateLoop counter in the plugin hits the value you set for UpdateRate on the measure, it resets to zero, and starts over. In the meantime, it goes out to the internet and gets stuff.

That is why, when you have Update=1000 on the skin, and UpdateRate=600 on a WebParser measure, it is "fired" every 10 minutes.

So if you use [!UpdateMeasure MyWebMeasure] on it, that will increment UpdateRateLoop by 1... You still have 598 to go, right?

If you use [!CommandMeasure MyWebMeasure "Update"] on it, that will override UpdateRateLoop, set it immediately to zero, and off you go.
Great explanation once again. So [!CommandMeasure MyWebMeasure "Update"] is really only applicable to WebParser measures?