It is currently April 18th, 2024, 11:33 pm

Activate/DeactivateConfig issue

Get help with creating, editing & fixing problems with skins
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Activate/DeactivateConfig issue

Post by pul53dr1v3r »

I've made option in a skin to load and unload other skins by clisk on a string button. It works fine but not flawlessly. The issue i've spotted is that State variable in the skin does not change if i load and unload skin via the Rainmeter menu. After System/Rainmeter restart it only keeps the skins i set in the skin, while the loaded/unloaded via Rainmeter have been reset.
My question is how to synchronize the skin's option with the Rainmeter's and vice versa, so the State changes also when i load/unload it via Rainmeter?

Code: Select all

[Variables]
State=1

[MeasureState]
Measure=Calc
Formula=#State#
DynamicVariables=1
IfEqualValue=0
IfEqualAction=[!SetOption MeterState Text "C:"][!SetOption "MeterState" "SolidColor" "64,64,64,250"][!DeactivateConfig "#RootConfig#\Disk Drives" "DriveC.ini"][!SetOption MeterState FontColor "200,200,200,255"][!UpdateMeter *][!Redraw]
IfAboveValue=0
IfAboveAction=[!SetOption MeterState Text "C:"][!SetOption "MeterState" "SolidColor" "85,85,85,250"][!ActivateConfig #RootConfig#\Disk Drives" "DriveC.ini][!SetOption MeterState FontColor "0,255,183,255"][!UpdateMeter *][!Redraw]

[MeterState]
...
LeftMouseUpAction=[!WriteKeyValue Variables State "(1-#State#)"][!SetVariable State "(1-#State#)"][!UpdateMeasure MeasureState]

Last edited by pul53dr1v3r on May 20th, 2019, 6:53 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Activate/DeactivateConfig issue

Post by balala »

You have to use jsmorley's ConfigActive plugin. It does exactly what are you looking for: it knows about the skins if they are loaded or not and even better, if they are hidden or shown. Install the plugin and give it a try: it's a magnificent plugin.
If you have installed it and have any question, please come back.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Activate/DeactivateConfig issue

Post by pul53dr1v3r »

balala wrote: May 18th, 2019, 6:48 pm
I've added the plugin's function to the code. It does just the job but too slow. Did i miss anything in order to get it works at an optimal rate?

Code: Select all

[ActiveConfig]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\CPU-RAM
IfCondition=([&ActiveConfig:IsActive(#ROOTCONFIG#\CPU-RAM)]=1)
IfTrueAction=[!SetOption MeterState LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\CPU-RAM" "CPU-RAM - Light.ini"]"""][!SetOption MeterState Text "on"][!SetOption "MeterState" "SolidColor" "85,85,85,250"][!SetOption MeterState FontColor "0,255,183,255"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterState LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\CPU-RAM" "CPU-RAM - Light.ini"]"""][!SetOption MeterState Text "off"][!SetOption "MeterState" "SolidColor" "64,64,64,250"][!SetOption MeterState FontColor "200,200,200,255"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterState]
Meter=String
X=10
Y=120
FontSize=10
StringStyle=Bold
Text=[ActiveConfig]
SolidColor=85,85,85,250
Padding=3,3,3,3
AntiAlias=1
DynamicVariables=1


Image
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Activate/DeactivateConfig issue

Post by balala »

Pul53dr1v3r wrote: May 20th, 2019, 10:50 am I've added the plugin's function to the code. It does just the job but too slow. Did i miss anything in order to get it works at an optimal rate?
Don't know, because it does work well and relatively quickly for me. Is the Update option of the skin set to the default Update=1000?
However I'd modify the IfCondtion option of the [ActiveConfig] measure, replacing the existing IfCondition=([&ActiveConfig:IsActive(Mirage\Slideshow)]=1) with IfCondition=(#CURRENTSECTION#>=1). There is not needed to overcomplicate things. Plus this step avoids needing to set on the dynamic variables on the measure, so you can simply remove the DynamicVariables=1 option of the [ActiveConfig] measure. The same DynamicVariables=1 option isn't needed nor on the [MeterState] meter, because the value shown by this meter is set by the appropriate !SetOption bang, used on the IfTrueAction / IfFalseAction options of the [ActiveConfig] measure.
It's still slow now?
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Activate/DeactivateConfig issue

Post by pul53dr1v3r »

balala wrote: May 20th, 2019, 1:48 pm Update=1000?
Not again... Unbelievable. :? I probably thought [!UpdateMeter *][!Redraw] are only in charge of doing it since the skin loads/unloads right away by pressing the button.
It's more or less ok now (~1s lag).

Pls ban me on the forum if this would happen once again.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Activate/DeactivateConfig issue

Post by balala »

Pul53dr1v3r wrote: May 20th, 2019, 3:00 pm Pls ban me on the forum if this would happen once again.
Don't worry, it happens to all of us sometimes. But how was set the Update?
And there is one more issue. The !ActivateConfig bang used into the IfAboveAction / IfFalseAction option of the [MeasureState] measure is (probably) correct, but the !DeactivateConfig used into the IfEqualValue / IfTrueAction option isn't. Although !ActivateConfig requires two parameters (the name of the config AND the name of the file you want to load), !DeactivateConfig requires just one single: the name of the config. The name of the file isn't needed, because Rainmeter doesn't care which file of the config is loaded, when the !DeactivateConfig bang is used, the actually loaded file is unloaded. So, remove the name of the file from the [!DeactivateConfig "#ROOTCONFIG#\CPU-RAM" "CPU-RAM - Light.ini"] bang, keeping just the name of the config: [!DeactivateConfig "#ROOTCONFIG#\CPU-RAM"]. It's completely enough.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Activate/DeactivateConfig issue

Post by pul53dr1v3r »

balala wrote: May 20th, 2019, 3:34 pm
The Update was set on 3600.
I noticed the difference where !DeactivateConfig doesn't requre file name (.ini) when i had a look at the morley's skin example but later i modded sth and it left. Also tested that it doesn't really need skin variant names. It does unload any variant of the skin. :thumbup:
:great:
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Activate/DeactivateConfig issue

Post by balala »

Pul53dr1v3r wrote: May 20th, 2019, 6:44 pm The Update was set on 3600.
Now I understand why the skin was reacting so slowly. This explains it.
Pul53dr1v3r wrote: May 20th, 2019, 6:44 pm I noticed the difference where !DeactivateConfig doesn't requre file name (.ini) when i had a look at the morley's skin example but later i modded sth and it left. Also tested that it doesn't really need skin variant names. It does unload any variant of the skin. :thumbup:
:great:
Yep, in fact (if I didn't forget any), the only bangs which need the name of the skin are !ActivateConfig and !ToggleConfig). These bangs do have to know which skin would you like to load (especially if in the config are more .ini files) and that's why they need to set the name of the file as well. But most bangs are working with the name of the config. Since from a config only one single skin can be loaded (NEVER MORE!), knowing the config, is completely enough. Most bangs are working with the currently loaded skin.