It is currently April 26th, 2024, 5:28 pm

Color Switcher not working

Get help with creating, editing & fixing problems with skins
User avatar
CoffeeJoe
Posts: 48
Joined: November 6th, 2019, 4:19 am

Color Switcher not working

Post by CoffeeJoe »

I have tried tearing this apart and putting in additional meters and measures to get the data to show me what's wrong.
I am missing something - but I can't help but feel like I almost have it.
Can I get another set of eyes to help me figure out what's wrong.
The core of it is all I really need - Random Measure / changes shades of grey on the background shape...
If there is a better way I'm always open for suggestions.

Thanks,

Code: Select all

[Rainmeter]
Update=5000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=
Author=CoffeeJoe
Information=
License=Creative Commons Attribution-NonCommercial-ShareAlike 3.0
Version=

[Variables]
SkinX=300
SkinY=300

[MeasureRandom]
Measure=Calc
Formula=Random
LowBound=1
HighBound=15
UpdateRandom=1
;OnUpdateAction=[!UpdateMeter "MeterString"][!Redraw "MeterString"]

[BackColor]
MeasureName=MeasureRandom
Measure=String
RegExpSubstitute=1
Substitute="1":"101010","2":"202020","3":"303030","4":"404040","5":"505050","6":"606060","7":"707070","8":"808080","9":"909090","10":"A0A0A0","11":"B0B0B0","12":"C0C0C0","13":"D0D0D0","14":"E0E0E0","15":"F0F0F0"
DynamicVariables=1

[MeterBack]
MeasureName=BackColor
Meter=Shape
W=#SkinX#
H=#SkinY#
Shape=Rectangle 0,0,#SkinX#,#SkinY# | Fill Color [BackColor] | StrokeWidth 0
DynamicVariables=1

[MeterString]
;MeasureName=[BackColor]
Meter=String
FontSize=18
SolidColor=606060
Padding=10,10,10,10
FontColor=FFFFFF
Text=[BackColor]
DynamicVariables=1
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Color Switcher not working

Post by mak_kawa »

Hi CoffeeJoe

First, String measure descriptionis is wrong.

Code: Select all

Measure=String
String=[MeasureRandom]
Second, RegExp description is not appropriate. Head and end of a line should be specified.

Code: Select all

Substitute="^1$":"101010","^2$":"202020","^3$":"303030","^4$":"404040","^5$":"505050","^6$":"606060","^7$":"707070","^8$":"808080","^9$":"909090","^10$":"A0A0A0","^11$":"B0B0B0","^12$":"C0C0C0","^13$":"D0D0D0","^14$":"E0E0E0","^15$":"F0F0F0"
Modified code works well for me.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Color Switcher not working

Post by mak_kawa »

And, although not important point...

Third, MeasureName=BackColor in MeterBack is not necessary.

Fourth, it is better to modify [MeterString] as below;

Code: Select all

Meter=String
MeasureName=BackColor
FontSize=18
SolidColor=606060
Padding=10,10,10,10
FontColor=FFFFFF
Text=%1
User avatar
CoffeeJoe
Posts: 48
Joined: November 6th, 2019, 4:19 am

Re: Color Switcher not working

Post by CoffeeJoe »

Thanks
I'll dig back in and see what I can make of it.

:D
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Color Switcher not working

Post by mak_kawa »

Some explanation on the RegExp substitute.

"10":"A0A0A0" substitutes the result of "1":"101010" substitute again, so finally "1" is substituted to "A0A0A0A0A0A0A0A0A0".
To avoid it, specify start and end of line by "^" and "$". This issue does not seem to occur in other substitutions, but "to make sure".
User avatar
CoffeeJoe
Posts: 48
Joined: November 6th, 2019, 4:19 am

Re: Color Switcher not working

Post by CoffeeJoe »

mak_kawa-
Looking at your suggestions, it appears you graded my technique on the bits of code I threw together to figure out why the bones of this aren't working.
I'm excited by the comment "modified code works" ... I don't see it yet.
The goal is to have the random generated color code change the fill color of the MeterBack Shape.
The string was an attempt to see what the values of different parts of the data are... it'll be deleted if I ever get the bones working.

Thanks,
User avatar
CoffeeJoe
Posts: 48
Joined: November 6th, 2019, 4:19 am

Re: Color Switcher not working

Post by CoffeeJoe »

mak_kawa wrote: December 16th, 2019, 9:01 am Some explanation on the RegExp substitute.

"10":"A0A0A0" substitutes the result of "1":"101010" substitute again, so finally "1" is substituted to "A0A0A0A0A0A0A0A0A0".
To avoid it, specify start and end of line by "^" and "$". This issue does not seem to occur in other substitutions, but "to make sure".
Good to know, I had read that before, but haven't run into it yet as none of the substitution is actually happening in my code... the measure returns either nothing (padding square 10x10) or the numeric value of the random formula
:confused:

That issue is what I would consider polish once the mechanics are functioning. My understanding is that it would still return some string value, even a wrong one if that part of the code was working.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Color Switcher not working

Post by mak_kawa »

Hi CoffeeJoe
This is the screen capture of working of modified code.
test2.gif
You do not have the required permissions to view the files attached to this post.
User avatar
CoffeeJoe
Posts: 48
Joined: November 6th, 2019, 4:19 am

Re: Color Switcher not working

Post by CoffeeJoe »

Good to see it works, I don't have it yet.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]
SkinX=300
SkinY=300

[BackColor]
Measure=Calc
Formula=Random
LowBound=1
HighBound=15
UpdateRandom=1
Substitute=^9$:"909090",^8$:"808080",^7$:"707070",^6$:"606060",^5$:"505050",^4$:"404040",^3$:"303030",^2$:"202020",^15$:"F0F0F0",^14$:"E0E0E0",^13$:"D0D0D0",^12$:"C0C0C0",^11$:"B0B0B0",^10$:"A0A0A0",^1$:"101010"
OnUpdateAction=[!UpdateMeter "MeterBack"][!Redraw MeterBack]
DynamicVariables=1

[MeterBack]
Meter=Shape
W=300
H=300
X=55
Y=73
Shape=Rectangle 0,0,#SkinX#,#SkinY# | Fill Color [BackColor] | StrokeWidth 0

[MeterString]
Meter=String
MeasureName=BackColor
FontSize=18
SolidColor=606060
Padding=10,10,10,10
FontColor=FFFFFF
Text=%1
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Color Switcher not working

Post by mak_kawa »

Full color version.
test2.gif

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=
Author=CoffeeJoe
Information=
License=Creative Commons Attribution-NonCommercial-ShareAlike 3.0
Version=

[Variables]
SkinX=300
SkinY=300

[MeasureRandomR1]
Measure=Calc
Formula=Random
LowBound=0
HighBound=15
UpdateRandom=1
Substitute="10":"A","11":"B","12":"C","13":"D","14":"E","15":"F"

[MeasureRandomR2]
Measure=Calc
Formula=Random
LowBound=0
HighBound=15
UpdateRandom=1
Substitute="10":"A","11":"B","12":"C","13":"D","14":"E","15":"F"

[MeasureRandomG1]
Measure=Calc
Formula=Random
LowBound=0
HighBound=15
UpdateRandom=1
Substitute="10":"A","11":"B","12":"C","13":"D","14":"E","15":"F"

[MeasureRandomG2]
Measure=Calc
Formula=Random
LowBound=0
HighBound=15
UpdateRandom=1
Substitute="10":"A","11":"B","12":"C","13":"D","14":"E","15":"F"

[MeasureRandomB1]
Measure=Calc
Formula=Random
LowBound=0
HighBound=15
UpdateRandom=1
Substitute="10":"A","11":"B","12":"C","13":"D","14":"E","15":"F"

[MeasureRandomB2]
Measure=Calc
Formula=Random
LowBound=0
HighBound=15
UpdateRandom=1
Substitute="10":"A","11":"B","12":"C","13":"D","14":"E","15":"F"

[BackColor]
Measure=String
String=[MeasureRandomR1][MeasureRandomR2][MeasureRandomG1][MeasureRandomG2][MeasureRandomB1][MeasureRandomB2]
DynamicVariables=1

[MeterBack]
Meter=Shape
W=#SkinX#
H=#SkinY#
Shape=Rectangle 0,0,#SkinX#,#SkinY# | Fill Color [BackColor] | StrokeWidth 0
DynamicVariables=1

[MeterString]
Meter=String
MeasureName=BackColor
FontSize=18
SolidColor=606060
Padding=10,10,10,10
FontColor=FFFFFF
Text=%1
Of course it is easier that color code is expressed by 0-255,0-255,0-255 decimal format rather than (0-F)(0-F)(0-F)(0-F)(0-F)(0-F) hexadecimal format.
You do not have the required permissions to view the files attached to this post.