It is currently March 29th, 2024, 3:15 pm

is there a way to load and unload skins?

Get help with creating, editing & fixing problems with skins
kenntwohlkeiner
Posts: 1
Joined: June 29th, 2022, 2:54 pm

is there a way to load and unload skins?

Post by kenntwohlkeiner »

can i script in one skin to load or unload another skin, specifically?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: is there a way to load and unload skins?

Post by balala »

kenntwohlkeiner wrote: January 6th, 2023, 2:35 pm can i script in one skin to load or unload another skin, specifically?
Definitely can. You have to use the !ActivateConfig bang to load and the !DeactivateConfig bang to unload a skin.
For instance if you add the following option to a meter of any skin: LeftMouseUpAction=[!ActivateConfig "MyConfig" "MySkin.ini"], you get the appropriate skin activated when you click the meter which you added this option to. To deactivate the same skin, use the following option: LeftMouseUpAction=[!DeactivateConfig "MyConfig"]. Or if you want to activate the skin if it's not or to deactivate it if it's activated, use this option: LeftMouseUpAction=[!ToggleConfig "MyConfig" "MySkin.ini"].
What you have to take care is to use the correct config name (in this case this is represented by MyConfig) and the correct skin name (MySkin.ini). Let's assume your skin you want to activate and / or deactivate is this: C:\Users\YourName\Documents\Rainmeter\Skins\illustro\Clock\12HrClock.ini. In this case the name of the config (MyConfig above) is illustro\Clock (it is starting from the Skins folder and doesn't include the .ini file), while the name of the skin is 12HrClock.ini. Accordingly the above options look this way: LeftMouseUpAction=[!ActivateConfig "illustro\Clock" "12HrClock.ini"], LeftMouseUpAction=[!DeactivateConfig "illustro\Clock"] and LeftMouseUpAction=[!ToggleConfig "illustro\Clock" "12HrClock.ini"].
Note a major difference between the !ActivateConfig / !ToggleConfig and !DeactivateConfig bangs. The first two (!ActivateConfig and !ToggleConfig) are requiring two parameters: the name of the config and the name of the skin itself (both can work only with the name of the config, but completely they can have these two parameters). The !DeactivateConfig bang on the other hand is requiring only one single parameter: the name of the config. The name of the skin is not needed, because if any skin of the specified config is loaded, Rainmeter knows which one is and you don't have to specify this expresly (however even if you do, the bang still works, because it simply ignores the not-needed parameter).
And one more: !DeactivateConfig (with no parameters) deactivates the current skin.