It is currently March 28th, 2024, 10:23 pm

[solved] WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

[solved] WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by Mor3bane »

Hi, I have recently solved an image skin loading issue. Now the task falls on the positioning of the Image Skin.

I read somewhere that the below added to the Rainmeter.ini will solve that issue.

Code: Select all

WindowX=50%
WindowY=50%
AnchorX=50%
AnchorY=50%
And it does indeed do exactly what I hoped for - centering the image skin on my display on both X and Y axis.

But if I switch between Layouts the setting disappears and defaults back to the upper left anchoring.

Can those positioning coordinates be set in the skin ini? I have been having trouble figuring this out.
Last edited by Mor3bane on May 22nd, 2018, 5:57 am, edited 1 time in total.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move "(([#SCREENAREAWIDTH]/2)-([#CURRENTCONFIGWIDTH]/2))" "(([#SCREENAREAHEIGHT]/2)-([#CURRENTCONFIGHEIGHT]/2))"]

[MeterImage]
Meter=Image
W=100
H=100
SolidColor=255,0,0,255
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by jsmorley »

If the size of the skin is going to change dynamically, and you want it to always stay centered, you might do:

Code: Select all

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

[MeasureCenter]
Measure=Calc
OnUpdateAction=[!Move "(([#SCREENAREAWIDTH]/2)-([#CURRENTCONFIGWIDTH]/2))" "(([#SCREENAREAHEIGHT]/2)-([#CURRENTCONFIGHEIGHT]/2))"]

[MeterImage]
Meter=Image
W=100
H=100
SolidColor=255,0,0,255
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by jsmorley »

I'm not a huge fan of using percentages in WindowX / WindowY / AnchorX / AnchorY in Rainmeter.ini to position skins on the screen, as they would need to be set that way in any Layout that uses the skin, and if you drag the skin somewhere else, those values are lost in Rainmeter.ini until you once again load the Layout. They are fine for distributing a suite of skins that should be positioned in particular spots on the screen and relative to each other, but you are likely going to want to turn draggable off in Rainmeter.ini for them as well, so they are always in a "fixed" position.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by Mor3bane »

jsmorley wrote:If the size of the skin is going to change dynamically, and you want it to always stay centered, you might do:

Code: Select all

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

[MeasureCenter]
Measure=Calc
OnUpdateAction=[!Move "(([#SCREENAREAWIDTH]/2)-([#CURRENTCONFIGWIDTH]/2))" "(([#SCREENAREAHEIGHT]/2)-([#CURRENTCONFIGHEIGHT]/2))"]

[MeterImage]
Meter=Image
W=100
H=100
SolidColor=255,0,0,255
DynamicVariables=1
Thanks jsmorely - I was trying to use that formula in the image X & Y - and it was going wonky. Yours works great. Thanks.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by jsmorley »

Mor3bane wrote:Thanks jsmorely - I was trying to use that formula in the image X & Y - and it was going wonky. Yours works great. Thanks.
If you are using something like FileView or QuotePlugin to dynamically change the image every xx seconds, it will be most efficient to do something like:

Code: Select all

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

[MeasureImage]
Measure=Plugin
Plugin=QuotePlugin
PathName=C:\Users\Jeffrey\Wallpaper
Subfolders=0
FileFilter=*.jpg;*.png
UpdateDivider=30
OnUpdateAction=[!UpdateMeter MeterImage][!Redraw]

[MeterImage]
Meter=Image
MeasureName=MeasureImage
W=300
PreserveAspectRatio=1
UpdateDivider=-1
OnUpdateAction=[!Move "(([#SCREENAREAWIDTH]/2)-([#CURRENTCONFIGWIDTH]/2))" "(([#SCREENAREAHEIGHT]/2)-([#CURRENTCONFIGHEIGHT]/2))"]
No point in centering the image on every skin update, or really any time other than when a new image is retrieved.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [solved] WindowX/Y and AnchorX/Y = 50% not saving in Rainmeter.ini

Post by Mor3bane »

Yep, yep.

The Image meter using the onupdate !Move bang would only need to update once the way I have it scripted.

Cheers.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.