It is currently March 29th, 2024, 10:07 am

Blocking skins or groups

Get help with installing and using Rainmeter.
DaThomas
Posts: 11
Joined: May 11th, 2017, 9:24 am

Blocking skins or groups

Post by DaThomas »

Hello,
Im new to Rainmeter and i would like to ask if there is any easy way to block activating of skins or groups.
I want to make a Button or Image that would toggle blocking by leftclicking.
Last edited by DaThomas on May 12th, 2017, 1:59 pm, edited 1 time in total.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Blocking skins or groups

Post by CyberTheWorm »

Something like this

Code: Select all

LeftMouseUpAction=[!ToggleConfig "Skinfolder\skinname" "skin.ini"]
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
DaThomas
Posts: 11
Joined: May 11th, 2017, 9:24 am

Re: Blocking skins or groups

Post by DaThomas »

Im not sure if that Is what im looking for, i read that toggleconfig activates or deactivates configs..., but i want to click on an image and that would block activating skin1 even if i clicked on yet another image that activates skin1.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Blocking skins or groups

Post by balala »

I don't think there would be a very simple such kind of possibility. The only one I can imagine would be to remove the LeftMouseupAction option of the button which normally activates the skin when you click the first button (image or whatever), then add it back. Not too simple, but I think it could work.
Do you know how to do this?
DaThomas
Posts: 11
Joined: May 11th, 2017, 9:24 am

Re: Blocking skins or groups

Post by DaThomas »

No, i don't know how to do that, could you please show it to me?
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Blocking skins or groups

Post by CyberTheWorm »

Do you have any code written for what your are trying to do? If so post it so we can take a look at it.
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
DaThomas
Posts: 11
Joined: May 11th, 2017, 9:24 am

Re: Blocking skins or groups

Post by DaThomas »

Im sorry. I don't have any code to that part yet, right now im struggling with making images for it.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Blocking skins or groups

Post by balala »

DaThomas wrote:No, i don't know how to do that, could you please show it to me?
Ok, here is a small code, please give it a try:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Lock=0

[MeasureLock]
Measure=Calc
Formula=#Lock#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterConfig LeftMouseUpAction """[!ToggleConfig "ControlledConfig" "ControlledINI.ini"]"""][!SetOption MeterLock Text "Lock"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterConfig LeftMouseUpAction ""][!SetOption MeterLock Text "Unlock"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterLock]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=14
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
LeftMouseUpAction=[!SetVariable Lock "(1-#Lock#)"][!UpdateMeasure "MeasureLock"][!UpdateMeter "#CURRENTSECTION#"]

[MeterConfig]
Meter=STRING
X=0r
Y=5R
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=14
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Toggle
Now a few explanations about what this code does: the whole process of locking / unlocking the skin activation / deactivation is controlled by the Lock variable (defined into the [Variables] section, with the initial Lock=0 value). This process is done by the [MeasureLock] measure, which, according to the value of the Lock variable, will attribute to the LeftMouseUpAction option of the [MeterConfig] meter either the [!ToggleConfig "ControlledConfig" "ControlledINI.ini"] value (if the value of the Lock variable is 0), or will leave it empty (I mean the LeftMouseUpAction option, if the value of the Lock variable is equal with 1 - in fact if it's greater then 0, but, at least based on the above code, if this variable is greater then 0, it surely is 1). In paralel, the [MeterLock] meter will get in the first case the "Lock" text (indicating that in this moment with this string you can lock the other string meter), while in second one, the "Unlock" text (I suppose you've understood what it indicates, in this case). According to the LeftMouseUpAction option of the [MeterLock] meter, each time you're clicking the Lock / Unlock string, the Lock variable will be updated and also the [MeasureLock], which means that the LeftMouseUpAction option of the [MeterConfig] meter will also be updated.
Using such Calc measures to control something in the skin has the great advantage that you can control more things with one single variable: in this case we're controlling / changing the text of the [MeterLock] meter AND the LeftMouseUpAction of the [MeterConfig] meter.
What you have to be careful is to replace the ControlledConfig and ControlledINI.ini config, respectively file name, with the needed ones. I used some generic names, but obviously you'll have to use those ones which are needed.
I hope I succeeded explaining the whole proces. It's not too hard to be understood, especially if you've get used to use some variables to control more things once.
Please let me know if you could adapt this code to your needs. If you didn't, please post the code you have so far, to can take a look and can give specific help, in that concrete situation.

EDIT: I just read you don't have any code so far. I hope you'll be able to adapt my code.
DaThomas
Posts: 11
Joined: May 11th, 2017, 9:24 am

Re: Blocking skins or groups

Post by DaThomas »

Thanks for the code ! This is the first time i came across Measures so it took a while until i understood it, im only not sure which meter is being updeted by [!UpdateMeter *] in IfActions. I tryed my best, but after i adapted this code it stopped working.
When i lock it, everything is fine, but when i try to unlock it, it won't unlock, it won't put in the UNLOCKED variable so i must have done something wrong and i can't find it.

Code: Select all

 
[Rainmeter]
Update=1000

[Variables]
MeterLockImgPath=#@#\LockButton.png
LauncherImgPath=#@#\Kirito.png
LauncherPath=E:\Tom
UNLOCKED=[!ActivateConfig "Kirito Launcher\Sidebars\right" "right.ini"][!ActivateConfig "Kirito Launcher\Deactivator" "Deactivator.ini"]
LOCKED=[!ActivateConfig "Kirito Launcher\Sidebars\left" "left.ini"][!ActivateConfig "Kirito Launcher\Deactivator" "Deactivator.ini"]
Lock=0

[Background]
Meter=IMAGE
SolidColor=111,111,111,0
W=350
H=150

[MeasureLock]
Measure=Calc
Formula=#Lock#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterLauncher LeftMouseUpAction """#UNLOCKED#"""][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterLauncher LeftMouseUpAction """#LOCKED#"""][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterLock]
Meter=IMAGE
ImageName=#MeterLockImgPath#
AntiAlias=1
LeftMouseUpAction=[!SetVariable Lock "(1-#Lock#)"][!UpdateMeasure "MeasureLock"][!UpdateMeter "#CURRENTSECTION#"]

[MeterLauncher]
Meter=Image
ImageName=#LauncherImgPath#
X=210
Y=92
AntiAlias=1
MiddleMouseUpAction=["#LauncherPath#"]  
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Blocking skins or groups

Post by balala »

DaThomas wrote:im only not sure which meter is being updeted by [!UpdateMeter *] in IfActions.
All meters of the current code. As same as in Windows, * means everything (all meters).
DaThomas wrote:I tryed my best, but after i adapted this code it stopped working.
When i lock it, everything is fine, but when i try to unlock it, it won't unlock, it won't put in the UNLOCKED variable so i must have done something wrong and i can't find it.
Sorry, no, you did nothing wrong, that's my fault. I forgot to add a DynamicVariables=1 option to the [MeterLock] meter. Please add it and try again the skin.