It is currently April 30th, 2024, 2:49 pm

[Beginner] Change Meterstyle via Conditions

Get help with creating, editing & fixing problems with skins
User avatar
Colorado
Posts: 18
Joined: July 18th, 2019, 5:06 pm

[Beginner] Change Meterstyle via Conditions

Post by Colorado »

Hello there,

I'm using a Google Calendar skin that I modified.
What I'd like to do is recolor the date on the skin if that string contains certain words.
I promise that I've tried to find a solution before posting.

I believe that only the two commented lines are pertinent to my question. Rest is there if needed.

Code: Select all

        [ItemWhat2]
	Meter=STRING
	X=56
	Y=70
	H=25
	W=(#SidebarWidth# * 0.65)
	Group=FeedData
	
	Text=#Item2Title#    
        MeterStyle=StyleReaderSubtext              
	

	[StyleReaderSubtext]
	X=12
	Y=5r
	H=14
	W=(#SidebarWidth#-0)
	ClipString=1
	StringStyle=BOLD
	StringEffect=Shadow
	FontColor=216, 27, 96
I would like for #Item2Title# string to determine which MeterStyle is selected.

Let's say, if "dog" is mentioned anywhere in #Item2Title# --> MeterStyle=StyleReaderDog instead of MeterStyle=StyleReaderSubtext.
I'd imagine this is a combination of Regex & IfMatch?
Just wasn't quite able to crack this one, gents.

Thanks!
Last edited by Colorado on October 21st, 2020, 6:01 pm, edited 1 time in total.
Learnin some Rainmeter I guess :uhuh:
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: [Beginner] Change Meterstyle via Conditions

Post by Alex88 »

I believe you should be able to just add this as a measure using IfMatchActions:

Code: Select all

[MeasureDateColor]
Measure=String
String=#Item2Title#

IfMatch=dog
IfMatchAction=[!SetOption ItemWhat2 MeterStyle "StyleReaderDog"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption ItemWhat2 MeterStyle "StyleReaderSubtext"][!UpdateMeter *][!Redraw]
User avatar
Colorado
Posts: 18
Joined: July 18th, 2019, 5:06 pm

Re: [Beginner] Change Meterstyle via Conditions

Post by Colorado »

Edit (for Clarify): See next post. Got confusing here.
Last edited by Colorado on October 20th, 2020, 10:41 pm, edited 2 times in total.
Learnin some Rainmeter I guess :uhuh:
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: [Beginner] Change Meterstyle via Conditions

Post by Alex88 »

The new lines posted above need to be within their own measure, their own block in a way; they can't be added to a meter. Afterwards check that the variables match where needed, i.e. #Item1Title# vs. #Item2Title# and similar.
User avatar
Colorado
Posts: 18
Joined: July 18th, 2019, 5:06 pm

Re: [Beginner] Change Meterstyle via Conditions

Post by Colorado »

Alex88 wrote: October 20th, 2020, 10:14 pm The new lines posted above need to be within their own measure, their own block in a way; they can't be added to a meter. Afterwards check that the variables match where needed, i.e. #Item1Title# vs. #Item2Title# and similar.
Image

Man. Unsure of what to do. Your code looks like similar Q&A's ... it just doesn't seem to want to recognize [MeasureDateColor]
Last edited by Colorado on October 20th, 2020, 10:44 pm, edited 1 time in total.
Learnin some Rainmeter I guess :uhuh:
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: [Beginner] Change Meterstyle via Conditions

Post by Alex88 »

The order of styles, measures, and meters generally doesn't matter, but what most have it as is Styles, Measures, then Meters. This is the full code that works when changing the #Item1Title# variable between dog and dot for example.

Code: Select all

[Variables]
SidebarWidth=100
Item1Title=dog

[StyleReaderDog]
X=12
Y=5r
H=14
W=(#SidebarWidth#-0)
ClipString=1
StringStyle=BOLD
StringEffect=Shadow
FontColor=119, 235,52

[StyleReaderSubtext]
X=12
Y=5r
H=14
W=(#SidebarWidth#-0)
ClipString=1
StringStyle=BOLD
StringEffect=Shadow
FontColor=216, 27, 96

[MeasureDateColor]
Measure=String
String=#Item1Title#

IfMatch=dog
IfMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderDog"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderSubtext"][!UpdateMeter *][!Redraw]

[ItemWhat1]
Meter=STRING
X=56
Y=70
H=25
W=(#SidebarWidth# * 0.65)
Group=FeedData

Text=#Item1Title#
I set all the variables for Item1 for this example in case that was causing problems.
User avatar
Colorado
Posts: 18
Joined: July 18th, 2019, 5:06 pm

Re: [Beginner] Change Meterstyle via Conditions

Post by Colorado »

Alex88 wrote: October 20th, 2020, 10:43 pm The order of styles, measures, and meters generally doesn't matter, but what most have it as is Styles, Measures, then Meters. This is the full code that works when changing the #Item1Title# variable between dog and dot for example.

Code: Select all

[Variables]
SidebarWidth=100
Item1Title=dog

[StyleReaderDog]
X=12
Y=5r
H=14
W=(#SidebarWidth#-0)
ClipString=1
StringStyle=BOLD
StringEffect=Shadow
FontColor=119, 235,52

[StyleReaderSubtext]
X=12
Y=5r
H=14
W=(#SidebarWidth#-0)
ClipString=1
StringStyle=BOLD
StringEffect=Shadow
FontColor=216, 27, 96

[MeasureDateColor]
Measure=String
String=#Item1Title#

IfMatch=dog
IfMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderDog"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderSubtext"][!UpdateMeter *][!Redraw]

[ItemWhat1]
Meter=STRING
X=56
Y=70
H=25
W=(#SidebarWidth# * 0.65)
Group=FeedData

Text=#Item1Title#
I set all the variables for Item1 for this example in case that was causing problems.
I think some progress is being made!

Only thing is that it keeps going with IfNotMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderSubtext"][!UpdateMeter *][!Redraw]
So when I change the StyleReaderSubtext to StyleReaderDog (inside the IfNotMatchAction line written above) ... it changes the font.
I'm assuming this means that your conditions are good! :) --- it just needs to not always be FALSE

Just, what regex would be needed to make the IfMatch= work?
Also, strangely, your [Variables] thing is being overwritten somehow by the macro that pulls from Gcal.
Learnin some Rainmeter I guess :uhuh:
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: [Beginner] Change Meterstyle via Conditions

Post by Alex88 »

To be sure, post your full code that you have like you did in your first post. What's posted above should work directly, it switches between the two styles when the variable is changed:

Click to animate
dogExample.gif
You do not have the required permissions to view the files attached to this post.
User avatar
Colorado
Posts: 18
Joined: July 18th, 2019, 5:06 pm

Re: [Beginner] Change Meterstyle via Conditions

Post by Colorado »

Alex88 wrote: October 20th, 2020, 11:09 pm To be sure, post your full code that you have like you did in your first post. What's posted above should work directly, it switches between the two styles when the variable is changed:

Click to animate
dogExample.gif
Nice gif!

Code: Select all

[Variables]
	SidebarWidth=100
	Item1Title=abcd


[StyleReaderSubtext]  
	X=12
	Y=5r
	H=14
	W=(#SidebarWidth#-0)
	ClipString=1
	StringStyle=BOLD
	StringEffect=Shadow
	FontColor=216, 27, 96 
	
	FontSize=8
	FontFace=#Font#
	AntiAlias=1
	ToolTipWidth=#SidebarWidth#
	DynamicVariables=1

[StyleReaderDog]  
	X=12
	Y=5r
	H=14
	W=(#SidebarWidth#-0)
	ClipString=1
	StringStyle=BOLD
	StringEffect=Shadow
	FontColor=50, 52, 168
	
	FontSize=8
	FontFace=#Font#
	AntiAlias=1
	ToolTipWidth=#SidebarWidth#
	DynamicVariables=1


[MeasureDateColor]
	Measure=String
	String=#Item1Title#

	IfMatch=dog
	IfMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderDog"][!UpdateMeter *][!Redraw]
	IfNotMatchAction=[!SetOption ItemWhat1 MeterStyle "StyleReaderSubtext"][!UpdateMeter *][!Redraw]
	
[ItemWhat1]
	Meter=STRING
	X=56
	Y=50
	H=25
	W=(#SidebarWidth# * 0.65)
	Group=FeedData
	Text=#Item1Title#
Is what I have. For some reason, the [Variables] does nothing. I think that the macro takes precedent.
Say I rename Item1Title=ABCD ... It will still appear Dog ... as that's what's on the Gcal
Learnin some Rainmeter I guess :uhuh:
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: [Beginner] Change Meterstyle via Conditions

Post by Alex88 »

The [Variables] section here is just for this example to work. if the variables are already previously defined, you don't need to include it, and try changing the variables in where its defined in Gcal.

Click
dogExample2.gif
You do not have the required permissions to view the files attached to this post.