It is currently May 4th, 2024, 12:33 am

How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Get help with creating, editing & fixing problems with skins
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by strawberryshortcake »

Hide/ShowMeter works well but (unfortunately) doesn't set color if for some reason the skin itself gets the [!Refresh] treatment. WriteKeyValue works great to permanently change color but it also (in my case) slows another skin (raindrop) down.


The video shows three effects to the same skin. Just trying to figure the best way to implement the desired effect of highlighting calendar days using color markers. Is there a fourth, fifth, etc. way to do it without the drawbacks?

Option 1:
(1) WriteKeyValue - via mousescrollleft/scrollright/scrolldown action changes the first box of the calendar. Notice how it affects (slows) the raindrop animation due to WriteKeyValue's associated [!Refresh]. Is there a solution for this?

Code: Select all

[Variables]

;	Default color of box highlight
BoxCOLOR1=30,30,30,5


[MNotes1a]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#Note1a#
Disabled=0
Separator=¶
#Subfolders=0
#FileFilter=*.txt
Hidden=1

[NotesM1a]
Meter=STRING
MeasureName=MNotes1a
X=5
Y=120
W=90
H=75
FontColor=255,255,255
FontFace=#FontName#
FontSize=8
StringAlign=LEFT
StringStyle=NORMAL
AntiAlias=1
ClipString=1


[Add1a]
Meter=IMAGE
Solidcolor=#BoxCOLOR1#
X=1
Y=115
W=99
H=80
AntiAlias=1

;MouseOverAction=!Execute [!RainmeterShowMeter AddOver1a][!RainmeterRedraw]
;MouseLeaveAction=!Execute [!RainmeterHideMeter AddOver1a][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["#Note1a#"]

; ------------------- CODE IN QUESTION --------------------------------
MouseScrollUpAction=[!WriteKeyValue Variables "BoxCOLOR1" "255,230,64,100"][!Refresh]
MouseScrollRightAction=[!WriteKeyValue Variables "BoxCOLOR1" "255,0,0,200"][!Refresh]
MouseScrollLeftAction=[!WriteKeyValue Variables "BoxCOLOR1" "0,0,255,200"][!Refresh]
MouseScrollDownAction=[!WriteKeyValue Variables "BoxCOLOR1" "30,30,30,5"] [!Refresh]
;DynamicVariables=1
;UpdateDivider=-1
;----------------------------------------------------------------

[AddOver1a]
Meter=IMAGE
;Solidcolor=0,0,0,20
Solidcolor=255,0,0,255
X=1
Y=115
W=99
H=80
AntiAlias=1
AntiAlias=1
Hidden=1


[AddOver1a_two]
Meter=IMAGE
Solidcolor=0,255,0,255
X=1
Y=115
W=99
H=80
AntiAlias=1
AntiAlias=1
Hidden=1
Option 2:
(2) Hide/ShowMeter - this method changes the skin box (purple/green) color quickly without any affect to the raindrop animation - nice (desired effect). However, when the skin is refreshed, the color change is lost.

Extra insignificant information: Not sure when I would actually need to refresh a finished calendar skin. But when I was testing the ultra notes calendar skin by modding it to add features, refreshing the skin was needed to properly display userinput information (still working on this part to figure out how to get things working properly).

I haven't tested it out yet, but I suspect if Option 2 was implemented to the entire skin, any calendar days highlight would be lost if I ever decided to refresh the skin. Obviously, transparency would be further adjusted for the final version so text is still visible.

Code: Select all

;--------------Notes1b-------------
[Variables]
AddBG=0,0,0,0

[MNotes1b]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#Note1b#
Disabled=0
Separator=¶
#Subfolders=0
#FileFilter=*.txt
Hidden=1



[NotesM1b]
Meter=STRING
MeasureName=MNotes1b
X=5
Y=220
W=90
H=75
FontColor=255,255,255
FontFace=#FontName#
FontSize=8
StringAlign=LEFT
StringStyle=NORMAL
AntiAlias=1
ClipString=1

[Add1b]
Meter=IMAGE
Solidcolor=#AddBG#
X=1
Y=215
W=99
H=80
AntiAlias=1
;MouseOverAction=!Execute [!RainmeterShowMeter AddOver1b][!RainmeterRedraw]
;MouseLeaveAction=!Execute [!RainmeterHideMeter AddOver1b][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["#Note1b#"]

;-------------- CODE IN QUESTION ----------------------------------
MouseScrollLeftAction=[!HideMeter AddOver1b_two][!ShowMeter AddOver1b][!Redraw]
MouseScrollRightAction=[!HideMeter AddOver1b][!ShowMeter AddOver1b_two][!Redraw]
MouseScrollDownAction=[!HideMeter AddOVer1b][!HideMeter AddOver1b_two][!Redraw]
;--------------------------------------------------------------------

[AddOver1b]
Meter=IMAGE
;				green color box (scroll left)
Solidcolor=0,255,0,255
X=1
Y=215
W=99
H=80
AntiAlias=1
AntiAlias=1
Hidden=1


[AddOver1b_two]
Meter=IMAGE
;				purple color box  (scroll right)	
Solidcolor=255,0,255,255
X=1
Y=215
W=99
H=80[Shadow][/Shadow]
AntiAlias=1
AntiAlias=1
Hidden=1
Option 3:
(3) WriteKeyValue without [!Refresh] but simply testing out [!UpdateMeter][!Update] to see if that does anything whatsoever. Unfortunately, it requires a skin refresh to permanently set the color change. My syntax setup is most likely wrong but I don't a see an error message in the log. The [!Update] after [!UpdatMeter] is probably useless, or is it? I've also tried [!Redraw].

Code: Select all

[Variables]
SHAPECOLOR=0,255,0,100

[MeterShapes]
Meter=Shape
;Shape=Rectangle 120,50,200,150 | Fill Color 255,0,0
Shape=Rectangle 120,50,200,150 | Fill Color #SHAPECOLOR#
X=50
Y=600

; 	CHANGE COLOR WRITEKEYVALUE PERMANENTLY ONLY when entire skin is refresh
LeftMouseUpAction=[!WriteKeyValue Variables "SHAPECOLOR" "255,0,0,100"][!UpdateMeter MeterShapes][!Update]

; 	CHANGE COLOR WRITEKEYVALUE PERMANENTLY ONLY when entire skin is refresh
RightMouseUpAction=[!WriteKeyValue Variables "SHAPECOLOR" "255,255,0,100"][!UpdateMeter MeterShapes][!Update]
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by balala »

strawberryshortcake wrote: November 3rd, 2020, 7:47 pm Option 1:
(1) WriteKeyValue - via mousescrollleft/scrollright/scrolldown action changes the first box of the calendar. Notice how it affects (slows) the raindrop animation due to WriteKeyValue's associated [!Refresh]. Is there a solution for this?
The first method is good, but you have to slightly modify it, in order to avoid the continous refresh. Replace the !writeKeyValue bangs of the MouseScrollUpAction, MouseScrollRightAction, MouseScrollLeftAction and MouseScrollDownAction options of the [Add1a] meter with !SetVariable bangs. This way you set dynamically values for the BoxCOLOR1 variable. Just make sure to add a DynamicVariables=1 option to all measures and meters which are using the variable, because otherwise the dynamically set value won't be used on those measures and meters.
Here is an example. Modify the MouseScrollUpAction, MouseScrollRightAction, MouseScrollLeftAction and MouseScrollDownAction options, as it follows:

Code: Select all

[Add1a]
...
MouseScrollUpAction=[!SetVariable BoxCOLOR1 "255,230,64,100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollRightAction=[!SetVariable BoxCOLOR1 "255,0,0,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollLeftAction=[!setVariable BoxCOLOR1 "0,0,255,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollDownAction=[!SetVariable BoxCOLOR1 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
See that, beside rewriting the !WriteKeyValue bangs with !SetVariable, I aslo replaced the [!Refresh] bangs with [!UpdateMeter "#CURRENTSECTION#"][!Redraw]. I did this because if you set dynamically the values of that variable, you don't have to refresh the skin (in fact if you do refresh it, the change is immediatelly lost), just have to (as said) update all measures and meters which are using the variable. In this case the only meter which uses it is [Add1a] itself, so since the options are set into the same meter, I didn't updated the [Add1a] meter (well, in fact I did update that one), but the #CURRENTSECTION# variable, which is always returning the name of the section in which it is used (in this case Add1a). A redraw of the skin is also done with a [!Redraw] bang.
I also added back the DynamicVariables=1 option to the meter, because you've commented it out. Above explaind why is it needed.
strawberryshortcake wrote: November 3rd, 2020, 7:47 pm Option 3:
(3) WriteKeyValue without [!Refresh] but simply testing out [!UpdateMeter][!Update] to see if that does anything whatsoever. Unfortunately, it requires a skin refresh to permanently set the color change.
Although the !WriteKeyValue bang is writing the new value of the variable into the [Variables] section even without a refresh, the skin doesn't (can't) use it until a refresh is done. This procedure can't be used this way, unfortunately.

Recommendation:
Both the !Execute bang and the !Rainmeter... bang prefix have been deprectaed extremely long time ago and you don't have to use them (used them on the commented out MouseOverAction and MouseLeaveAction options, as well as on the LeftMouseDownAction option of the [Add1b] meter).
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by eclectic-tech »

Option4: !WriteKeyValue + !SetVariable + DynamicVariables + !UpdateMeter + !Redraw

If you want to:
1) change a value of a variable
2) use it right away without refreshing the skin
3) but also retain the new value when refreshed

then you MUST use !WriiteKeyValue to permanently write the new value AND use !SetVariable to set the new value in the currently loaded skin.
Note you MUST ADD DynamicVariables=1 to all sections that use the variable so they can react to any change in value.

Code: Select all

[Add1a]
...
MouseScrollUpAction=[!WriteKeyValue Variables BoxCOLOR1 "255,230,64,100"][!SetVariable BoxCOLOR1 "255,230,64,100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollRightAction=[!WriteKeyValue Variables BoxCOLOR1 "255,0,0,200"][!SetVariable BoxCOLOR1 "255,0,0,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollLeftAction=[!WriteKeyValue Variables BoxCOLOR1 "0,0,255,200"][!SetVariable BoxCOLOR1 "0,0,255,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollDownAction=[!WriteKeyValue Variables BoxCOLOR1 "30,30,30,5"][!SetVariable BoxCOLOR1 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by strawberryshortcake »

balala wrote: November 3rd, 2020, 8:53 pm
The first method is good, but you have to slightly modify it, in order to avoid the continous refresh. Replace the !writeKeyValue bangs of the MouseScrollUpAction, MouseScrollRightAction, MouseScrollLeftAction and MouseScrollDownAction options of the [Add1a] meter with !SetVariable bangs. This way you set dynamically values for the BoxCOLOR1 variable. Just make sure to add a DynamicVariables=1 option to all measures and meters which are using the variable, because otherwise the dynamically set value won't be used on those measures and meters.
Here is an example. Modify the MouseScrollUpAction, MouseScrollRightAction, MouseScrollLeftAction and MouseScrollDownAction options, as it follows:

Code: Select all

[Add1a]
...
MouseScrollUpAction=[!SetVariable BoxCOLOR1 "255,230,64,100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollRightAction=[!SetVariable BoxCOLOR1 "255,0,0,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollLeftAction=[!setVariable BoxCOLOR1 "0,0,255,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollDownAction=[!SetVariable BoxCOLOR1 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
See that, beside rewriting the !WriteKeyValue bangs with !SetVariable, I aslo replaced the [!Refresh] bangs with [!UpdateMeter "#CURRENTSECTION#"][!Redraw]. I did this because if you set dynamically the values of that variable, you don't have to refresh the skin (in fact if you do refresh it, the change is immediatelly lost), just have to (as said) update all measures and meters which are using the variable. In this case the only meter which uses it is [Add1a] itself, so since the options are set into the same meter, I didn't updated the [Add1a] meter (well, in fact I did update that one), but the #CURRENTSECTION# variable, which is always returning the name of the section in which it is used (in this case Add1a). A redraw of the skin is also done with a [!Redraw] bang.
I also added back the DynamicVariables=1 option to the meter, because you've commented it out. Above explaind why is it needed.

Although the !WriteKeyValue bang is writing the new value of the variable into the [Variables] section even without a refresh, the skin doesn't (can't) use it until a refresh is done. This procedure can't be used this way, unfortunately.

Recommendation:
Both the !Execute bang and the !Rainmeter... bang prefix have been deprectaed extremely long time ago and you don't have to use them (used them on the commented out MouseOverAction and MouseLeaveAction options, as well as on the LeftMouseDownAction option of the [Add1b] meter).
QUESTION: Does anyone know why the boxes flickers near the end of the video ( @0:40 mark onward)


Code is the example on the left side of the screen.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
SHAPECOLOR=0,255,0,100
BoxCOLOR1=255,230,64,100
BoxCOLOR2=255,230,64,100

;--------- LARGE BOX
[MeterShapes]
Meter=Shape
;Shape=Rectangle 120,50,200,150 | Fill Color 255,0,0
Shape=Rectangle 120,50,200,150 | Fill Color #SHAPECOLOR#
X=50
Y=600
UpdateDivider=-1

;--------- small box on left 
[Add1a]
Meter=IMAGE
;Solidcolor=0,200,100,255
SolidColor=#BoxCOLOR1#
X=600
Y=700
W=99
H=80
AntiAlias=1

MouseScrollUpAction=[!SetVariable BoxCOLOR1 "255,230,64,50"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!WriteKeyValue Variables "BoxCOLOR1" "255,230,64,100"]
MouseScrollRightAction=[!SetVariable BoxCOLOR1 "255,0,0,80"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!WriteKeyValue Variables "BoxCOLOR1" "255,0,0,200"]
MouseScrollLeftAction=[!setVariable BoxCOLOR1 "0,0,255,80"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!WriteKeyValue Variables "BoxCOLOR1" "0,0,255,200"]
MouseScrollDownAction=[!SetVariable BoxCOLOR1 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!WriteKeyValue Variables "BoxCOLOR1" "30,30,30,5"]
DynamicVariables=1
UpdateDivider=-1



;--------- small box on right
[Add1b]
Meter=IMAGE
;Solidcolor=0,200,100,255
SolidColor=#BoxCOLOR2#
X=800
Y=700
W=99
H=80
AntiAlias=1
MouseScrollUpAction=[!SetVariable BoxCOLOR2 "255,230,64,50"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR2" "255,230,64,100"][!Redraw]
MouseScrollRightAction=[!SetVariable BoxCOLOR2 "255,0,0,80"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR2" "255,0,0,200"][!Redraw]
MouseScrollLeftAction=[!setVariable BoxCOLOR2 "0,0,255,80"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR2" "0,0,255,200"][!Redraw]
MouseScrollDownAction=[!SetVariable BoxCOLOR2 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR2" "30,30,30,5"][!Redraw]
DynamicVariables=1
UpdateDivider=-1



SetOption worked nicely. No more multiple refresh logs. Because I still wanted the set color permanent feature I decided to try separating out [!Refresh] from [!WriteKeyValue] by creating a completely separate button that has one simple job ... and that is to refresh the skin when clicked, not sure which is correct though even though they both work.

LeftMouseUpAction=[!Refresh #CURRENTCONFIG#] or LeftMouseUpAction=[!Refresh]


Code: Select all

MouseScrollUpAction=[!SetVariable BoxCOLOR1 "255,230,64,70"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR1" "255,230,64,100"][!Redraw]
MouseScrollRightAction=[!SetVariable BoxCOLOR1 "255,0,0,70"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR1" "255,0,0,200"][!Redraw]
MouseScrollLeftAction=[!SetVariable BoxCOLOR1 "0,0,255,70"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR1" "0,0,255,200"][!Redraw]
MouseScrollDownAction=[!SetVariable BoxCOLOR1 "30,30,30,55"][!UpdateMeter "#CURRENTSECTION#"][!WriteKeyValue Variables "BoxCOLOR1" "30,30,30,5"][!Redraw]
DynamicVariables=1


[MeterShapes]
Meter=Shape
Shape=Rectangle 120,50,200,150 | Fill Color 255,0,0
;Shape=Rectangle 120,50,200,150 | Fill Color #SHAPECOLOR#
X=50
Y=600
;LeftMouseUpAction=[!Refresh #CURRENTCONFIG#]
LeftMouseUpACtion=[!Refresh]
Last edited by strawberryshortcake on November 4th, 2020, 12:36 am, edited 4 times in total.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by strawberryshortcake »

eclectic-tech wrote: November 3rd, 2020, 9:38 pm Option4: !WriteKeyValue + !SetVariable + DynamicVariables + !UpdateMeter + !Redraw

If you want to:
1) change a value of a variable
2) use it right away without refreshing the skin
3) but also retain the new value when refreshed

then you MUST use !WriiteKeyValue to permanently write the new value AND use !SetVariable to set the new value in the currently loaded skin.
Note you MUST ADD DynamicVariables=1 to all sections that use the variable so they can react to any change in value.

Code: Select all

[Add1a]
...
MouseScrollUpAction=[!WriteKeyValue Variables BoxCOLOR1 "255,230,64,100"][!SetVariable BoxCOLOR1 "255,230,64,100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollRightAction=[!WriteKeyValue Variables BoxCOLOR1 "255,0,0,200"][!SetVariable BoxCOLOR1 "255,0,0,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollLeftAction=[!WriteKeyValue Variables BoxCOLOR1 "0,0,255,200"][!SetVariable BoxCOLOR1 "0,0,255,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollDownAction=[!WriteKeyValue Variables BoxCOLOR1 "30,30,30,5"][!SetVariable BoxCOLOR1 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
Sweet Saw your code after I thought about just creating a completely separate !Refresh on demand button. but my syntax is out of order. I'll use yours instead.

EDIT: Might as well ask it here. Is UpdateDivider=-1 useless if I put it immediately after DynamicVariables=1 ?
EDIT2: Does the order matter? [!WriteKeyValue][!SetOption] vs [!SetOption][!WriteKeyValue]
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by strawberryshortcake »

Clear / Reset all colors back to default?

Is there a way to set a group on variables to accomplish something like such

Code: Select all

[!WriteKeyValue VariableGroup #BoxColor1#:#BoxColor42# "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!Refresh]
Or is having 42 total [!WriteKeyValues] the only way to do it currently?

Code: Select all

;--------- RESET / CLEAR COLORBOX BACK TO DEFAULT
[MeterShapesBOX]
Meter=Shape
Shape=Rectangle 120,50,200,150 | Fill Color #SHAPECOLOR_CLEAR#
X=500
Y=200
;LeftMouseUpAction=[!HideMeterGroup CLEAR]
;RightMouseUpAction=[!ShowMeterGroup CLEAR]
LeftMouseUpAction=[!WriteKeyValue Variables BoxCOLOR2 "30,30,30,255"][!WriteKeyValue Variables BoxCOLOR1 "30,30,30,255"][!Redraw][!Refresh]
UpdateDivider=-1

All 42 BoxCOLOR ... as [!WriteKeyValue]

Code: Select all

LeftMouseUpAction=[!WriteKeyValue Variables BoxCOLOR1a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR1b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR1c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR1d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR1e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR1f "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR2a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR2b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR2c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR2d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR2e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR2f "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR3a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR3b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR3c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR3d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR3e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR3f "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR4a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR4b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR4c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR4d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR4e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR4f "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR5a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR5b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR5c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR5d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR5e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR5f "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR6a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR6b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR6c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR6d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR6e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR6f "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR7a "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR7b "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR7c "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR7d "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR7e "30,30,30,5"][!WriteKeyValue Variables BoxCOLOR7f "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!Refresh]

Code: Select all

[Rainmeter]
Update=1000

[Variables]
SHAPECOLOR=0,255,255,100
SHAPECOLOR_CLEAR=255,0,0,255
BoxCOLOR1=0,0,255,200
BoxCOLOR2=255,230,64,100



;--------- LARGE BOX (REFRESH SKIN BOX)
[MeterShapes]
Meter=Shape
;Shape=Rectangle 120,50,200,150 | Fill Color 255,0,0
Shape=Rectangle 120,50,200,150 | Fill Color #SHAPECOLOR#
X=50
Y=600
UpdateDivider=-1
LeftMouseUpAction=[!Refresh]
DynamicVariables=1



;--------- small box on left 
[Add1a]
Meter=IMAGE
;Solidcolor=0,200,100,255
SolidColor=#BoxCOLOR1#
GROUP=CLEAR
X=600
Y=700
W=99
H=80
AntiAlias=1

MouseScrollUpAction=[!WriteKeyValue Variables BoxCOLOR1 "255,230,64,100"][!SetVariable BoxCOLOR1 "255,230,64,100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollRightAction=[!WriteKeyValue Variables BoxCOLOR1 "255,0,0,200"][!SetVariable BoxCOLOR1 "255,0,0,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollLeftAction=[!WriteKeyValue Variables BoxCOLOR1 "0,0,255,200"][!SetVariable BoxCOLOR1 "0,0,255,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollDownAction=[!WriteKeyValue Variables BoxCOLOR1 "30,30,30,5"][!SetVariable BoxCOLOR1 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
UpdateDivider=-1


;--------- small box on right
[Add1b]
Meter=IMAGE
SolidColor=#BoxCOLOR2#
GROUP=CLEAR
X=800
Y=700
W=99
H=80
AntiAlias=1
MouseScrollUpAction=[!WriteKeyValue Variables BoxCOLOR2 "255,230,64,100"][!SetVariable BoxCOLOR2 "255,230,64,100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollRightAction=[!WriteKeyValue Variables BoxCOLOR2 "255,0,0,200"][!SetVariable BoxCOLOR2 "255,0,0,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollLeftAction=[!WriteKeyValue Variables BoxCOLOR2 "0,0,255,200"][!SetVariable BoxCOLOR2 "0,0,255,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollDownAction=[!WriteKeyValue Variables BoxCOLOR2 "30,30,30,5"][!SetVariable BoxCOLOR2 "30,30,30,5"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
UpdateDivider=-1



;--------- RESET / CLEAR COLORBOX BACK TO DEFAULT
[MeterShapesBOX]
Meter=Shape
Shape=Rectangle 120,50,200,150 | Fill Color #SHAPECOLOR_CLEAR#
X=500
Y=200
;LeftMouseUpAction=[!HideMeterGroup CLEAR]
;RightMouseUpAction=[!ShowMeterGroup CLEAR]
LeftMouseUpAction=[!WriteKeyValue Variables BoxCOLOR2 "30,30,30,255"][!WriteKeyValue Variables BoxCOLOR1 "30,30,30,255"][!UpdateMeter "#CURRENTSECTION#"][!Redraw][!Refresh]
UpdateDivider=-1


EDIT: I probably should (and will) redo it so it's easier to customize the color markers [!WriteKeyValue BoxCOLOR2 #SCROLLUPCOLOR#]
User avatar
deflore08
Posts: 209
Joined: July 12th, 2020, 7:47 am
Location: Ada, Garden City

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by deflore08 »

Regret, but you have to use 42 !WriteKeyValue bangs for this, if you want apply it permanently. :(
Image * Image * Image * Image
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by balala »

strawberryshortcake wrote: November 3rd, 2020, 11:54 pm QUESTION: Does anyone know why the boxes flickers near the end of the video ( @0:40 mark onward)
No, I don't know, but couldn't replicate the flickering. I just suppose some skins are overlaping each other, causing that issue. As said, I don't have it, but I'm not even sure what did you do when the meter flickered. What did you? Simply hovering the mouse over, clicking or what?
strawberryshortcake wrote: November 3rd, 2020, 11:54 pm SetOption worked nicely.
Did you use somewhere a !SetOption bang? Beacuse I don't see it, just !SetVariable.
strawberryshortcake wrote: November 3rd, 2020, 11:54 pm Because I still wanted the set color permanent feature I decided to try separating out [!Refresh] from [!WriteKeyValue] by creating a completely separate button that has one simple job ... and that is to refresh the skin when clicked, not sure which is correct though even though they both work.
As eclectic-tech posted, you can use a combination of [!SetVariable / !SetOption], [!WriteKeyValue], [!UpdateMeasure], [!UpdateMeter] and [!Redraw] bangs to do both: an immediate update of the variable / option and a permanent change, which will be used in case of a refresh. Some detials here: https://forum.rainmeter.net/viewtopic.php?f=5&t=35211&p=175954#p175955
There is no such thing as "correct" code snippet. Which is "correct" and which is "incorrect" depends on what you want to achieve. As more times has been said above:
  • If using !WriteKeyValue the variable / option will be permanently written to the code, but won't be used unless a refresh is done.
  • If using !SetVariable / !SetOption, the change is dyanamic and can be used immediately in the code, but don't persist on a refresh.
If using both, take care not to refresh the skin, because if you do refresh it, the dynamic change is lost. But usually we use the combination of both exactly to register permanently the change (which will be used in case of an eventual refresh) but not to be forced to refresh the skin (the !SetVariable / !SetOption let the skin to dynamically use the change).
strawberryshortcake wrote: November 3rd, 2020, 11:54 pm LeftMouseUpAction=[!Refresh #CURRENTCONFIG#] or LeftMouseUpAction=[!Refresh]
LeftMouseUpAction=[!Refresh] refreshes the current skin, which belongs to the current config. This is refreshed by the LeftMouseUpAction=[!Refresh #CURRENTCONFIG#] option as well. So there is no difference between these two LeftMouseUpActions.
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by balala »

strawberryshortcake wrote: November 3rd, 2020, 11:56 pm EDIT: Might as well ask it here. Is UpdateDivider=-1 useless if I put it immediately after DynamicVariables=1 ?
EDIT2: Does the order matter? [!WriteKeyValue][!SetOption] vs [!SetOption][!WriteKeyValue]
In none of these the order doesn't matter. In fact there are extremely less cases when the order of bangs does matter. The order of options never matters, you can use them in any order.
An example when the order of bangs does matter is if you use a !Delay bang: the bangs used before the !Delay will be executed, then a time set on the !Delay bang will be waited, then the following bangs will be executed. The order of bangs does matter here extremely much.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: How to change color permanently without [!Refresh] of entire skin? ( WriteKeyValue, SetOption, Hide/ShowMeter )

Post by strawberryshortcake »

balala wrote: November 4th, 2020, 8:43 am No, I don't know, but couldn't replicate the flickering. I just suppose some skins are overlaping each other, causing that issue. As said, I don't have it, but I'm not even sure what did you do when the meter flickered. What did you? Simply hovering the mouse over, clicking or what?
I'm using a K400 logitech (keyboard plus touchpad combination).

No biggie, it's relatively controllable so it doesn't trigger if I'm careful. It's specific to the MouseScrollDownAction direction only. Never triggers with Scroll -Up, -Left or -Right. I think it has something to do with the ability of the touchpad to scroll continuously when I quickly swipe and release my fingers in the down direction. It also works in the up direction, but it simply doesn't trigger the flicker. Light controlled downward touch and it does not trigger the flicker.
balala wrote: November 4th, 2020, 8:43 am Did you use somewhere a !SetOption bang? Beacuse I don't see it, just !SetVariable.
My mistake, I meant SetVariable. I keep getting those two things mixed up.
balala wrote: November 4th, 2020, 8:43 am As eclectic-tech posted, you can use a combination of [!SetVariable / !SetOption], [!WriteKeyValue], [!UpdateMeasure], [!UpdateMeter] and [!Redraw] bangs to do both: an immediate update of the variable / option and a permanent change, which will be used in case of a refresh. Some detials here: https://forum.rainmeter.net/viewtopic.php?f=5&t=35211&p=175954#p175955
There is no such thing as "correct" code snippet. Which is "correct" and which is "incorrect" depends on what you want to achieve. As more times has been said above:
  • If using !WriteKeyValue the variable / option will be permanently written to the code, but won't be used unless a refresh is done.
  • If using !SetVariable / !SetOption, the change is dyanamic and can be used immediately in the code, but don't persist on a refresh.
If using both, take care not to refresh the skin, because if you do refresh it, the dynamic change is lost. But usually we use the combination of both exactly to register permanently the change (which will be used in case of an eventual refresh) but not to be forced to refresh the skin (the !SetVariable / !SetOption let the skin to dynamically use the change).

LeftMouseUpAction=[!Refresh] refreshes the current skin, which belongs to the current config. This is refreshed by the LeftMouseUpAction=[!Refresh #CURRENTCONFIG#] option as well. So there is no difference between these two LeftMouseUpActions.
Bookmark. :thumbup: