It is currently May 1st, 2024, 8:35 am

If statements

Get help with creating, editing & fixing problems with skins
overture3d
Posts: 3
Joined: September 2nd, 2012, 7:55 pm

If statements

Post by overture3d »

I am kind of new to rainmeter skin design and I need help understanding how to use if statements in a rainmeter skin. Basically what I want to do is when I click a button on the skin it changes the value of a variable. I then want to have the skin choose which picture to draw based on the value of the variable.

Thanks, and any help is appriciated. :)
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: If statements

Post by MerlinTheRed »

Actually you don't necessarily need any IfActions for this. If the variable you want to set is the actual name of the image file, you could do something like this:

Code: Select all

[Rainmeter]
Update=1000
MiddleMouseUpAction=!Refresh #CURRENTCONFIG#

[Variables]
FileName=Image1

[Setvar]
Meter=String
FontColor=ffffff
SolidColor=000000
LeftMouseUpAction=[!SetVariable FileName Image2][!Update]

[Image]
Meter=Image
X=r
Y=R
ImageName=C:\Some\Path\#FileName#.png
DynamicVariables=1

This will initially display Image1.png and then switch to Image2.png when you click the button.

If you want to cycle through a number of images when clicking the button, have a look at the Quote Plugin.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!