It is currently May 26th, 2024, 11:50 pm

Getting the value of X, Y, H, or W

Get help with creating, editing & fixing problems with skins
User avatar
ForceX
Posts: 100
Joined: January 16th, 2010, 10:32 pm

Getting the value of X, Y, H, or W

Post by ForceX »

Is it possible to measure the value of any X, Y, H, W and use that number to drive another X, Y, H, W.

I want to be able to take the Y position value of a Meter=Image or Meter=String and apply it to the H position value of a Meter=Image.

This way it will create a dynamically adjusting skin background, that will adjust it's self based on the amount of content contained within it.

Example of what I'm trying to do

[Skin Background Box] <------ First line of code
Meter=Image
W=100
H= ( The Y Value of Meter A )


Put your stuff here

[stuff_1]
X=0
Y=25r

[stuff_2]
X=0
Y=25r

[stuff_3]..... Skin Background Box is now adjusting it's height to stay with [Meter A]
X=0
Y=25r

[Meter A] <------ last line of code
Meter=String
X=0
Y=10r <----------- Y= is relatively equal to 85. Make [Skin Background Box] H=(return 85)
Hidden=1
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Getting the value of X, Y, H, or W

Post by Alex2539 »

There's no way to directly get any of a meter's values. However, depending on what the content is, there may be a workaround. If it's something like a launch bar, or anything where the different meters are all the same size, you can create a variable to keep track of the number of items. Then, all you need to do is make the height of the background equal the number of items times the height of the items, like this:

Code: Select all

[Variables]
NumItems=5
ItemSize=25

...
...

[SkinBG]
Meter=Image
W=100
H=(#NumItems#*#ItemSize#)
...

...
...
The ItemSize variable is optional, but it will make changing things around easier later.
ImageImageImageImage
User avatar
ForceX
Posts: 100
Joined: January 16th, 2010, 10:32 pm

Re: Getting the value of X, Y, H, or W

Post by ForceX »

Cool. Thanks for the reply
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Getting the value of X, Y, H, or W

Post by dragonmage »

Alternatively, you can use

[Rainmeter]
BackgroundMode=3
Background=image.png
Backgroundmargins=10,10,10,10
DynamicWindowSize=1

That scales the area of the image inside the margins you set to contain the content dynamically. No extra adjustments required.

It is important to note that all content will be contained inside the margins, even if you set a W and H manually. This means, (using example above) if you set W=100, on screen the skin will actually take up 120 pixels. 100 + left margin + right margin.