It is currently March 28th, 2024, 12:06 pm

write key value problem

Get help with creating, editing & fixing problems with skins
Post Reply
swagginnate
Posts: 12
Joined: February 11th, 2018, 8:25 am

write key value problem

Post by swagginnate »

Im trying to make a shape change from pointed corners to curved corners with a middle mouse click but i cant get the !write key value command to work

Code: Select all

[rainmeter]
update=400

[variables]
corner1=0,0
corner2=0,32
corner3=201,32
corner4=201,1
curve1=10,0 | curveto 0,10,0,0
curve2=0,22 | curveto 10,32,0,32
curve3=191,32 | curveto 201,22,201,32
curve4=201,10 | curveto 191,0,201,0

[titlebackground]
meter=shape
shape=rectangle 2,2,197,15 |  Fill color 0,0,0,150 | strokecolor 0,0,0,150
updatedivider=-1


;[background]
;meter=shape
;shape=path mypath | stroke color 155,155,155,200 | Fill color 0,0,0,100 | stroke width 1
;mypath=#curve1# | Lineto #curve2# | lineto #curve3# | lineto #curve4# | closepath 1

[background]
meter=shape
shape=path mypath | stroke color 155,155,155,200 | Fill color 0,0,0,100 | stroke width 1
mypath=#corner1# | lineto #corner2# | lineto #corner3# | lineto #corner4# | closepath 1 
dynamicvariables=1

[tlCorner]
meter=image
solidcolor=0,0,0,2
x=0
y=0
h=10
w=10
MiddleMouseDownAction=!execute [!WriteKeyValue Variables corner1 #curve1#][!refresh]
dynamicvariables=1
Last edited by swagginnate on February 13th, 2018, 8:35 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: write key value problem

Post by jsmorley »

Code: Select all

[rainmeter]
update=400

[variables]
corner1=10,0 | curveto 0,10,0,0
corner2=0,32
corner3=201,32
corner4=201,1
curve1=10,0 | curveto 0,10,0,0
curve2=0,22 | curveto 10,32,0,32
curve3=191,32 | curveto 201,22,201,32
curve4=201,10 | curveto 191,0,201,0

[titlebackground]
meter=shape
shape=rectangle 2,2,197,15 |  Fill color 0,0,0,150 | strokecolor 0,0,0,150
updatedivider=-1


;[background]
;meter=shape
;shape=path mypath | stroke color 155,155,155,200 | Fill color 0,0,0,100 | stroke width 1
;mypath=#curve1# | Lineto #curve2# | lineto #curve3# | lineto #curve4# | closepath 1

[background]
meter=shape
shape=path mypath | stroke color 155,155,155,200 | Fill color 0,0,0,100 | strokewidth 1
mypath=#corner1# | lineto #corner2# | lineto #corner3# | lineto #corner4# | closepath 1
dynamicvariables=1

[tlCorner]
meter=image
solidcolor=0,0,0,2
x=0
y=0
h=10
w=10
MiddleMouseDownAction=[!WriteKeyValue Variables corner1 "#curve1#"][!refresh]
dynamicvariables=1
The problems are two main ones.

First, while not fatal, It's StrokeWidth, not Stroke Width in the Shape meter. That will not work, although the default value is "1" so you might not have known, but it will flood the log with errors on every meter update.

https://docs.rainmeter.net/manual/meters/shape/#StrokeWidth
https://docs.rainmeter.net/manual/user-interface/about/#LogTab

Second, and this IS fatal to your functionality, the value of the variable #curve1# has spaces in it, so it must be used with "quotes" as a parameter in a bang. The entire bang will fail.

https://docs.rainmeter.net/manual/skins/option-types/#Action

Additionally, while it's ignored, the !Execute bang was deprecated years ago and need not / should not be used.

https://docs.rainmeter.net/manual/bangs/#Execute

Lastly, and just a nitpick... While Rainmeter is generally case-insensitive, you will find your code a lot prettier and easier to read (especially for others) if you consistently use CamelCase for names. It should be StrokeWidth, not strokewidth, DynamicVariables, not dynamicvariables, and Meter=Shape not meter=shape.
swagginnate
Posts: 12
Joined: February 11th, 2018, 8:25 am

Re: write key value problem

Post by swagginnate »

Thanks for the help!
Post Reply