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

Trying to open skin with another skin. Plz Help!

Get help with creating, editing & fixing problems with skins
garmadon1972
Posts: 3
Joined: July 2nd, 2017, 7:12 pm

Trying to open skin with another skin. Plz Help!

Post by garmadon1972 »

Hi I'm pretty new to coding Rainmeter skins. I've been using Rainmeter for a while and wanted to start making my own personal skins. I've been successful until it came to this one. As you can tell by the thread name I'm trying to "click a skin and have it activate another skin" if this isn't possible I would like to have the other skin become visible and invisible when the "Button" skin is clicked.
I'm not sure what I did wrong, like I said I'm pretty new... :confused:

Here's my code:

Code: Select all

[Rainmeter]

Update=1000

[MeterButtonImage]
Meter=Image
ImageName="C:\Users\Owner\Documents\Rainmeter\Skins\Command Button\CenterButton"
W=200
H=200
ImageAlpha=255
LeftMouseUpAction=[!ToggleConfig ""C:\Users\Owner\Documents\Rainmeter\Skins\rksclockwork\RKS clockwork.ini"]
Thanks in advanced to everyone ! :D
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Trying to open skin with another skin. Plz Help!

Post by fonpaolo »

What you want is possible, but you've to change something:

Code: Select all

LeftMouseUpAction=[!ToggleConfig "rksclockwork" "RKS clockwork.ini"]
Read here: ToggleConfig

Another suggestion is to change the ImageName:

Code: Select all

ImageName=#@#Command Button\CenterButton.png
Note that the image has an extension, ".png", you can change it to the correct format.
Read here: ImageName

It's also Better if you move your images in a folder, for a better organization of your skin.
Read here: ImagePath
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to open skin with another skin. Plz Help!

Post by balala »

Try the following LeftMouseUpAction: LeftMouseUpAction=[!ToggleConfig "rksclockwork" "RKS clockwork.ini"] (I hope the path of the config and the name of the ini file are correct).
Problems:
  • You had two quotation marks at the beginning.
  • Have to include the name of the config and the name of the ini file into different pairs of quotation marks.
  • Don't have to add the whole path of the config, just starting from the Skins folder (its path is known by Rainmeter - accutualy usually this is the first variable included into the [Rainmeter] saection of the Rainmeter.ini file, which stores the settings of the app, as SkinPath variable).
EDIT: sorry fonpaolo, you just beat me (again)...
garmadon1972
Posts: 3
Joined: July 2nd, 2017, 7:12 pm

Re: Trying to open skin with another skin. Plz Help!

Post by garmadon1972 »

I tried both suggestions, changing the action did not seem to work as it would not toggle the secondary skin. Changing the image name made the skin go invisible as if the image was entirely transparent. Any other suggestions?
Here is the current code:

Code: Select all

[Rainmeter]

Update=1000

[MeterButtonImage]
Meter=Image
ImageName=#@#Command Button\CenterButton.png
W=200
H=200
ImageAlpha=255
LeftMouseUpAction=LeftMouseUpAction=[!ToggleConfig "rksclockwork" "RKS clockwork.ini"]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to open skin with another skin. Plz Help!

Post by balala »

garmadon1972 wrote:I tried both suggestions, changing the action did not seem to work as it would not toggle the secondary skin.
What is the path of the file with the above code? Are you sure the posted path of the RKS clockwork.ini file is correct (I think it is, but make sure it is)?
garmadon1972 wrote:Changing the image name made the skin go invisible as if the image was entirely transparent. Any other suggestions?
The new image is entirely transparent? If so, there is no suggestion, maybe just to use a non-transparent image.

Maybe would be a good idea to pack both configs and upload the package, to can check.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Trying to open skin with another skin. Plz Help!

Post by eclectic-tech »

garmadon1972 wrote:I tried both suggestions, changing the action did not seem to work as it would not toggle the secondary skin. Changing the image name made the skin go invisible as if the image was entirely transparent. Any other suggestions?
Here is the current code:

Code: Select all

[Rainmeter]

Update=1000

[MeterButtonImage]
Meter=Image
ImageName=#@#Command Button\CenterButton.png
W=200
H=200
ImageAlpha=255
LeftMouseUpAction=LeftMouseUpAction=[!ToggleConfig "rksclockwork" "RKS clockwork.ini"]
You have "LeftMouseUpAction=LeftMouseUpAction=..." in the [MeterButtonImage] section... fix that by removing the duplicate bang.

As balala said, the issue is probably due to an incorrect parameter in the !ToggleConfig bang.

Open !Manage, !Log and see what error messages you are getting, that will tell you why it is not working.

Aside: Having spaces in the names of images, config names, etc. will cause problems. Avoid using spaces, and enclose every parameter of bangs and paths inside quotation marks. e.g. ImageName="#@#Command Button\CenterButton.png"
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to open skin with another skin. Plz Help!

Post by balala »

eclectic-tech wrote:You have "LeftMouseUpAction=LeftMouseUpAction=..." in the [MeterButtonImage] section... fix that by removing the duplicate bang.
I didn't notice that, but you're definitely right.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trying to open skin with another skin. Plz Help!

Post by jsmorley »

eclectic-tech wrote: Aside: Having spaces in the names of images, config names, etc. will cause problems. Avoid using spaces, and enclose every parameter of bangs and paths inside quotation marks. e.g. ImageName="#@#Command Button\CenterButton.png"
Not to nitpick, but quotes are required around parameters in bangs. While only strictly required when there are, or might be, spaces in the parameter, I'd just use them every time, to get in the habit.

IfTrueAction=[!SetOption MeterImage ImageName "#@#Command Button\CenterButton.png"]
LeftMouseUpAction=[!SetVariable MyColor "255,255,255,255"]

However, quotes are not required around option values in measures or meters. In fact starting and ending "quotes" on an option value like ImageName="#@#Command Button\CenterButton.png" are just thrown away and ignored. Because an option value doesn't have "parameters", but simply a single "value", spaces won't confuse it.

Having said that... Generally speaking, you can never use quotes one too many times, only one too few...

I do agree with the suggestion that spaces be avoided in the names of things, like image files, meter and measure section names, config names, skin names, etc. It's not that Rainmeter can't handle it, but using spaces means you need to be much more careful, and certain, that you quote things properly when you use them in bangs.

IfTrueAction=[!SetOption "My Image Meter" ImageName "#@#Command Button\CenterButton.png"]
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Trying to open skin with another skin. Plz Help!

Post by eclectic-tech »

Nitpicking approved ;-)

Thanks for the clarification. I usually just use quotes to avoid possible issues.

So you are saying a path variable, like #@#, that contains spaces, will be resolved properly, even if not enclosed in quotes?

If so, then I do apologize for misinforming... :(
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trying to open skin with another skin. Plz Help!

Post by jsmorley »

eclectic-tech wrote:Nitpicking approved ;-)

Thanks for the clarification. I usually just use quotes to avoid possible issues.

So you are saying a path variable, like #@#, that contains spaces, will be resolved properly, even if not enclosed in quotes?

If so, then I do apologize for misinforming... :(
It will be resolved fine without quotes if used in an option value like:

ImageName=#@#My Images\My Buttons\My First Button.png

However it would need quotes when used as a parameter in a bang, like:

LeftMouseUpAction=[!SetOption MyMeter ImageName "#@#My Images\My Buttons\My First Button.png"]
This is because a bang is made up of a bang name, and one or more required and optional parameters. In this case
!BangName SectionName OptionName OptionValue ConfigName
As you can see, the parameters themselves are delineated by spaces. It has to be able to properly "tear apart" the bang to set the correct parameters, and without quotes, spaces in any of them will totally confuse it.

Again, while it's kinda nitpicking since quotes almost can never hurt, the rules actually are:

Quotes are never needed around option values, spaces or not.

RegExp=(?siU)<Some Tag with Spaces>(.*)</Some Tag with Spaces>
BarImage=#@#Images\My Bars\My Red Bar.png
Text=Some text on a String meter

Quotes not needed on any of those...

Quote MAY be needed, and should always be used, on string parameters of any bang.

LeftMouseUpAction=[!SetOption MyBarMeter BarImage "#@#Images\My Bars\My Red Bar.png"]
LeftMouseUpAction=[!SetOption MyStringMeter Text "Some text on a String meter"]
LeftMouseUpAction=[!SetVariable MyColorVar "255,255,255,255"]


Extra Credit:

There are two exceptions.. Aren't there always.

The Substitute option, while not needing any quotes to deal with spaces, requires as a component of how the option works, that the elements of the Substitute are enclosed in quotes:

Substitute="Red":"Blue"

That has the effect of having starting and ending quotes on the option value, but in this case they are not thrown away and ignored as with other options.

The Command and Parameter options on the RunCommand plugin may need stating and ending quotes, as the value itself may need to be quoted to work with Windows:

Parameter=""C:\Program Files\MyProgram.exe""

Note that we have two sets of "quotes" at the beginning and end. The first two are thrown away and ignored as usual, but then the second two are actually passed to Windows to properly execute a shell command that has spaces in it.


Advanced Placement:

What if you need to have actual quotes in the value you are using in the parameter of a bang?

For instance:

Text=This is a string with a "quoted bit" in it

How would you set that in a bang?

LeftMouseUpAction=[!SetOption MyStringMeter Text """This is a string with a "quoted bit" in it"""]

In this case, the quotes in the parameter itself can also cause confusion. The solution is to use """magic quotes""" which is how you tell Rainmeter that what follows is a string that itself contains quotes, and those embedded quotes should not be treated as beginning or ending a parameter.

https://docs.rainmeter.net/manual-beta/skins/option-types/#MagicQuotes