It is currently May 4th, 2024, 11:38 am

Vary the width or height of an image

Get help with creating, editing & fixing problems with skins
NN1
Posts: 5
Joined: September 17th, 2012, 4:23 am

Vary the width or height of an image

Post by NN1 »

Hello,

I read that we can use formulas for the width or height parameters, for example :

W=(300/3) instead of W=100

After hours of trying, I can't find how to use a variable in there instead which would be related to a Calc.

Is it possible or would there be another way? Sorry if it's a dumb question but I really can't find how and couldn't find a related topic here. Thanks a lot in advance. :welcome:

Code: Select all

[CalcWidth]
Measure=Calc
Formula=((UsedDiskSpace/TotalDiskSpace)*100)

[image7]
Meter=IMAGE
X=0r
Y=0r
W=[CalcWidth]
H=70
ImageName=images\example.bmp
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Vary the width or height of an image

Post by jsmorley »

You just need to add DynamicVariables=1 to your image meter, and it will work as you have it.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Vary the width or height of an image

Post by MerlinTheRed »

NN1 wrote:

Code: Select all

[CalcWidth]
Measure=Calc
Formula=((UsedDiskSpace/TotalDiskSpace)*100)

[image7]
Meter=IMAGE
X=0r
Y=0r
W=[CalcWidth]
H=70
ImageName=images\example.bmp
You have to add DynamicVariables=1 to any meter or measure that uses a measure's value in square brackets. Apart from that, I'd advise you not to multiply by 100 in the formula and instead multiply by the desired width in the image meter (thus making the code more re-usable). That's just an advice though. It will work just fine if you do nothing else but add DynamicVariables=1 to the image meter.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Vary the width or height of an image

Post by jsmorley »

There really is no need for the Calc measure at all with Rainmeter 2.4.

[image7]
Meter=IMAGE
ImageName=images\example.bmp
X=0r
Y=0r
W=([UsedDiskSpace]/[TotalDiskSpace]*100)
H=70
DynamicVariables=1

http://rainmeter.net/cms/Skins-SectionVariables_beta
NN1
Posts: 5
Joined: September 17th, 2012, 4:23 am

Re: Vary the width or height of an image

Post by NN1 »

Hey ! Thanks a lot to both of you, it works ! :thumbup:

I'll have a more tricky question later, but it's not about the same parameter, so I'll open another thread later.

Thanks again ! :welcome: