It is currently May 14th, 2024, 6:18 pm

Can't get !SetOption to work correctly

Get help with creating, editing & fixing problems with skins
silicatemega
Posts: 1
Joined: January 10th, 2019, 2:20 am

Can't get !SetOption to work correctly

Post by silicatemega »

Hi

I'm new to RainMeter skins. To start, I tried to edit the following skin:

https://www.deviantart.com/sjoti/art/Checklist-1-0-617138087

Code: Select all

[MeasureInput]
Measure=Plugin
Plugin=InputText
MeterStyle=CheckboxStyle
x=#TextBoxPosR#
Y=5
H=25
W=240
DefaultValue="Change Me!"
Command1=!WriteKeyValue Variables Checkbox1 "$UserInput$" Y=20 "#@#Var.ini"
Command2=!Refresh "#CURRENTCONFIG#"
Command3=!WriteKeyValue Variables Checkbox2 "$UserInput$" Y=65 "#@#Var.ini"
Command4=!Refresh "#CURRENTCONFIG#"
Command5=!WriteKeyValue Variables Checkbox3 "$UserInput$" Y=105 "#@#Var.ini"
Command6=!Refresh "#CURRENTCONFIG#"
Command7=!WriteKeyValue Variables Checkbox4 "$UserInput$" Y=145 "#@#Var.ini"
Command8=!Refresh "#CURRENTCONFIG#"
Command9=!WriteKeyValue Variables Checkbox5 "$UserInput$" Y=185 "#@#Var.ini"
Command10=!Refresh "#CURRENTCONFIG#"
Command11=!WriteKeyValue Variables Checkbox6 "$UserInput$" Y=225 "#@#Var.ini"
Command12=!Refresh "#CURRENTCONFIG#"
Command13=!WriteKeyValue Variables Checkbox7 "$UserInput$" Y=265 "#@#Var.ini"
Command14=!Refresh "#CURRENTCONFIG#"
Command15=!WriteKeyValue Variables Checkbox8 "$UserInput$" Y=305 "#@#Var.ini"
Command16=!Refresh "#CURRENTCONFIG#"
Command17=!WriteKeyValue Variables Checkbox9 "$UserInput$" Y=345 "#@#Var.ini"
Command18=!Refresh "#CURRENTCONFIG#"
Y=75 
DefaultValue="Text file path and name"
Solidcolor=150,150,150



;[MeterPlus]
;Meter=Image
;ImageName=#@#/Images/Glass.png
;W=#TotalWidth#
;H=#TotalHeight#

;[MeterBackground]
;Meter=Image 
;ImageName=#@#/Images/bg2.jpg
;W=#TotalWidth#
;H=#TotalHeight#
;ImageAlpha=50

;[MeterTitle]
;Meter=Image


;[MeterCheckedArea]
;Meter=Image
;Y=20r
;x=#CheckboxposR#
;W=#TotalWidth#
;H=((#StatusBox1# + #StatusBox2# + #StatusBox3# + #StatusBox4# + #StatusBox5# +  #StatusBox6# + #StatusBox7# + #StatusBox8#) * #BoxSize#)

[MeterArea]
Meter=Image
Y=0
x=0
W=290
H=400
Solidcolor=#Color#


[MeterCheckbox1]
Meter=String
x=20
Y=20r
FontFace=#TopFont#
Text=#Checkbox1#
FontColor=240,240,240
StringStyle=Bold
solidcolor=0,0,0,1
FontSize=20
antialias=1
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1-2"

[MeterLinetop]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#TextBoxPosR#
y=r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1-2"

[MeterLine1]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=30r

[MeterLine11]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 3-4"

[MeterCheckbox2]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox2#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 3-4"

[Metercheckbox1Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox1#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox1 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox1UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1 - #Statusbox1#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox1 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]


[MeterLine2]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine12]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 5-6"

[MeterCheckbox3]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox3#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 5-6"

[Metercheckbox2Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox2#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox2 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox2UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1 - #Statusbox2#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox2 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[MeterLine3]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine13]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 7-8"

[MeterCheckbox4]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox4#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 7-8"


[Metercheckbox3Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox3#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox3 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox3UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1 - #Statusbox3#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox3 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[MeterLine4]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine14]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 9-10"

[MeterCheckbox5]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox5#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 9-10"

[Metercheckbox4Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox4#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox4 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox4UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1 - #Statusbox4#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox4 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[MeterLine5]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine15]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 11-12"

[MeterCheckbox6]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox6#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 11-12"

[Metercheckbox5Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox5#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox5 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox5UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1- #Statusbox5#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox5 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[MeterLine6]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine16]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 13-14"

[MeterCheckbox7]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox7#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 13-14"

[Metercheckbox6Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox6#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox6 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox6UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1 - #Statusbox6#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox6 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[MeterLine7]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine17]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 15-16"

[MeterCheckbox8]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
Text=#Checkbox8#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 15-16"

[Metercheckbox7Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox7#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox7 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox7UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1-#Statusbox7#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox7 "0" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]



[MeterLine8]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine7]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r

[MeterLine18]
Meter=Image
Solidcolor=0,0,0,1
w=250
h=30
x=#Rightposition#
y=10r
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 17-18"

[MeterCheckbox9]
Meter=String
x=#TextBoxPosR#
Y=10r
MeterStyle=CheckboxStyle
InlineSetting=None
Text=#Checkbox9#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 17-18"

[Metercheckbox8Checked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/Checked.png
Hidden=#Statusbox8#
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox8 "1" "#@#Var.ini"][!Refresh "#CURRENTCONFIG#"]

[Metercheckbox8UnChecked]
Meter=Image
W=20
H=20
x=#CheckboxposR#
Y=r
ImageName=#@#/Images/UnChecked.png
Hidden=(1 - #Statusbox8#)
LeftMouseUpAction=[!WriteKeyValue Variables StatusBox8 "0" "#@#Var.ini"][!SetOption MeterCheckbox9 InlineSetting Strikethrough][!UpdateMeter MeterCheckbox9][!Redraw][!Refresh "#CURRENTCONFIG#"]



[MeterLine9]
Meter=Image
Solidcolor=0,0,0,100
w=250
h=1
x=#Rightposition#
y=20r
The part of interest is this one

Code: Select all

LeftMouseUpAction=[!WriteKeyValue Variables StatusBox8 "0" "#@#Var.ini"][!SetOption MeterCheckbox9 InlineSetting Strikethrough][!UpdateMeter MeterCheckbox9][!Redraw][!Refresh "#CURRENTCONFIG#"]
It's under [Metercheckbox8UnChecked]. I added the !SetOption in order to add the strikethrough to the text whenever the checkbox is unchecked. It doesn't work however. When I click the strikethrough it just flashes for a second.

Does anyone have any idea how to fix it? Thanks
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Can't get !SetOption to work correctly

Post by eclectic-tech »

The reason the change does not persist is that !SetOption is not a permanent change to the coded section, while !WriteKeyValue is a permanent change to coded sections. You change the option but then immediately refresh the config, which changes the option back to the original value.

To have it persist through refresh, use !WriteKeyValue:

Code: Select all

LeftMouseUpAction=[!WriteKeyValue Variables StatusBox8 "0" "#@#Var.ini"][!WriteKeyValue MeterCheckbox9 InlineSetting Strikethrough][!Refresh "#CURRENTCONFIG#"]
Since you are refreshing the config, you do not need to update the meter or redraw.
User avatar
balala
Rainmeter Sage
Posts: 16217
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can't get !SetOption to work correctly

Post by balala »

In addition to eclectic-tech's reply, I'd add that at a first look (I have to admit I didn't enter too deeply into the code though) there is no reason to write those variables physically (with !WriteKeyValue bang) and refresh the skin, would be a much better idea to set them dynamically (through !SetVariable bang), which avoid the need to refresh the skin. If is needed, along with setting those variables dynamically, you can also write them with !WriteKeyValue bangs, but in this case you don't have to refresh the skin. However if they are written, if for any reason you're refreshing the skin, the previously set new value of any of those variables is kept, being written to the [Variables] section.
Keep in mind that the refresh is a destructive operation and as much as possible it must be avoided. Obviously there are cases when it must be used, but not too many. I tend to not use it if there is any other possibility. A few details: https://forum.rainmeter.net/viewtopic.php?f=5&t=22739&p=120238&hilit=refresh+both+balala#p120238