It is currently April 19th, 2024, 5:38 pm

[Solved] Is it possible to make a "Click Counter"?

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Solved] Is it possible to make a "Click Counter"?

Post by balala »

CodeCode wrote: December 21st, 2020, 7:38 am That's fairly basic. Using Shape meters for that should be better than using an image - that reduces dependencies for image files etc.
Right. This is definitely possible without using images. And as said, it's much better and simpler to do it so.
If no one posts a sample, later today I'm gonna post one.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Solved] Is it possible to make a "Click Counter"?

Post by balala »

balala wrote: December 21st, 2020, 7:54 am If no one posts a sample, later today I'm gonna post one.
Alright, finally here is the promised code:

Code: Select all

[Variables]
Width=300
Clicks=0

[StringStyle]
Padding=15,5,15,5
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,1
FontFace=Segoe UI
StringAlign=CenterCenter
AntiAlias=1
DynamicVariables=1

[MeterButton]
Meter=Shape
X=2
Y=60
Shape=Rectangle 0,10,#Width#,50,10 | Extend MyModifiers1
Shape2=Rectangle 0,0,#Width#,50,10 | Extend MyModifiers2
MyModifiers1=Fill Color 26,113,193 | StrokeWidth 0 | Stroke Color 26,113,193,0
MyModifiers2=Fill Color 41,141,223 | StrokeWidth 0 | Stroke Color 41,141,223,0
LeftMouseDownAction=[!SetVariable Clicks "(#Clicks#+1)"][!SetOption MeterButton Shape2 "Rectangle 0,10,#Width#,50,10 | Extend MyModifiers2"][!SetOption MeterButtonLabel Y "([MeterButton:Y]+[MeterButton:H]/2+5)"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterButtonLabel"][!UpdateMeter "MeterResult"][!Redraw]
LeftMouseUpAction=[!SetOption MeterButton Shape2 "Rectangle 0,0,#Width#,50,10 | Extend MyModifiers2"][!SetOption MeterButtonLabel Y "([MeterButton:Y]+[MeterButton:H]/2-5)"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterButtonLabel"][!Redraw]
MouseLeaveAction=[!SetOption MeterButton Shape2 "Rectangle 0,0,#Width#,50,10 | Extend MyModifiers2"][!SetOption MeterButtonLabel Y "([MeterButton:Y]+[MeterButton:H]/2-5)"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterButtonLabel"][!Redraw]
DynamicVariables=1

[MeterButtonLabel]
Meter=STRING
MeterStyle=StringStyle
X=([MeterButton:X]+#Width#/2)
Y=([MeterButton:Y]+[MeterButton:H]/2-5)
FontColor=220,220,220
FontSize=12
StringStyle=BOLD
Text=Start Clicking

[MeterResult]
Meter=STRING
MeterStyle=StringStyle
X=0r
Y=24
FontColor=220,220,220
FontSize=40
Text=#Clicks#

[MeterReset]
Meter=STRING
MeterStyle=StringStyle
X=0r
Y=140
FontColor=26,113,193
FontSize=12
StringStyle=BOLD
Text=Reset
LeftMouseUpAction=[!SetVariable Clicks "0"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterResult"][!Redraw]
You do not have the required permissions to view the files attached to this post.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: [Solved] Is it possible to make a "Click Counter"?

Post by CodeCode »

balala wrote: December 21st, 2020, 6:58 pm Alright, finally here is the promised code:

Code: Select all

[Variables]
Width=300
Clicks=0

[StringStyle]
Padding=15,5,15,5
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,1
FontFace=Segoe UI
StringAlign=CenterCenter
AntiAlias=1
DynamicVariables=1

[MeterButton]
Meter=Shape
X=2
Y=60
Shape=Rectangle 0,10,#Width#,50,10 | Extend MyModifiers1
Shape2=Rectangle 0,0,#Width#,50,10 | Extend MyModifiers2
MyModifiers1=Fill Color 26,113,193 | StrokeWidth 0 | Stroke Color 26,113,193,0
MyModifiers2=Fill Color 41,141,223 | StrokeWidth 0 | Stroke Color 41,141,223,0
LeftMouseDownAction=[!SetVariable Clicks "(#Clicks#+1)"][!SetOption MeterButton Shape2 "Rectangle 0,10,#Width#,50,10 | Extend MyModifiers2"][!SetOption MeterButtonLabel Y "([MeterButton:Y]+[MeterButton:H]/2+5)"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterButtonLabel"][!UpdateMeter "MeterResult"][!Redraw]
LeftMouseUpAction=[!SetOption MeterButton Shape2 "Rectangle 0,0,#Width#,50,10 | Extend MyModifiers2"][!SetOption MeterButtonLabel Y "([MeterButton:Y]+[MeterButton:H]/2-5)"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterButtonLabel"][!Redraw]
MouseLeaveAction=[!SetOption MeterButton Shape2 "Rectangle 0,0,#Width#,50,10 | Extend MyModifiers2"][!SetOption MeterButtonLabel Y "([MeterButton:Y]+[MeterButton:H]/2-5)"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterButtonLabel"][!Redraw]
DynamicVariables=1

[MeterButtonLabel]
Meter=STRING
MeterStyle=StringStyle
X=([MeterButton:X]+#Width#/2)
Y=([MeterButton:Y]+[MeterButton:H]/2-5)
FontColor=220,220,220
FontSize=12
StringStyle=BOLD
Text=Start Clicking

[MeterResult]
Meter=STRING
MeterStyle=StringStyle
X=0r
Y=24
FontColor=220,220,220
FontSize=40
Text=#Clicks#

[MeterReset]
Meter=STRING
MeterStyle=StringStyle
X=0r
Y=140
FontColor=26,113,193
FontSize=12
StringStyle=BOLD
Text=Reset
LeftMouseUpAction=[!SetVariable Clicks "0"][!UpdateMeter "MeterButton"][!UpdateMeter "MeterResult"][!Redraw]
that lookss perfect! Niiice.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Solved] Is it possible to make a "Click Counter"?

Post by balala »

CodeCode wrote: December 21st, 2020, 8:00 pm that lookss perfect! Niiice.
I'm glad if you think so.
chandkumar3g
Posts: 1
Joined: January 18th, 2021, 2:18 pm

Re: [Solved] Is it possible to make a "Click Counter"?

Post by chandkumar3g »

hello,

Thank you so much for sharing this helpful information, it helped me alot

Thanks and regards.:)
glass-houses
Posts: 2
Joined: January 22nd, 2021, 7:52 am

Re: [Solved] Is it possible to make a "Click Counter"?

Post by glass-houses »

Hello, I am really grateful for this thread and to those who have replied. I would just like to ask if there is a way to retain the counter information regardless of refreshing or updating the skins? I sadly have little knowledge in coding and there's limited information I can find online on how to do this. I would very much appreciate your responses.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Solved] Is it possible to make a "Click Counter"?

Post by balala »

glass-houses wrote: January 22nd, 2021, 7:57 am Hello, I am really grateful for this thread and to those who have replied. I would just like to ask if there is a way to retain the counter information regardless of refreshing or updating the skins? I sadly have little knowledge in coding and there's limited information I can find online on how to do this. I would very much appreciate your responses.
For this you have to write the current value of the Clicks variable to the [Variables] section. Just add a [!WriteKeyValue Variables Clicks "(#Clicks#+1)"] bang beside [!SetVariable Clicks "(#Clicks#+1)"], in the LeftMouseDownAction option of the [MeterButton] meter into my previously posted code.
glass-houses
Posts: 2
Joined: January 22nd, 2021, 7:52 am

Re: [Solved] Is it possible to make a "Click Counter"?

Post by glass-houses »

balala wrote: January 22nd, 2021, 3:28 pm For this you have to write the current value of the Clicks variable to the [Variables] section. Just add a [!WriteKeyValue Variables Clicks "(#Clicks#+1)"] bang beside [!SetVariable Clicks "(#Clicks#+1)"], in the LeftMouseDownAction option of the [MeterButton] meter into my previously posted code.
I see, thank you very much for the help!
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Solved] Is it possible to make a "Click Counter"?

Post by balala »

glass-houses wrote: January 26th, 2021, 7:33 am I see, thank you very much for the help!
You're welcome. Did it help?