It is currently January 26th, 2021, 9:32 pm

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

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 12112
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: 12112
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: 233
Joined: September 7th, 2020, 2:24 pm

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.
Can't fix it if it ain't broke - unless it is in code.
User avatar
balala
Rainmeter Sage
Posts: 12112
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.
kathykiwn
Posts: 1
Joined: January 14th, 2021, 9:44 am

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

Post by kathykiwn »

Thank you so much you all. I am a beginner and was trying to make a counter like this click counter . Tried searching on youtube and google but did not get anything. Finally, just because of you guys I made it. As a beginner, it's a huge achievement for me <3. Thank you all for the help especially balala. :)
User avatar
balala
Rainmeter Sage
Posts: 12112
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

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

Post by balala »

kathykiwn wrote: January 14th, 2021, 10:12 am Thank you so much you all. I am a beginner and was trying to make a counter like this click counter . Tried searching on youtube and google but did not get anything. Finally, just because of you guys I made it. As a beginner, it's a huge achievement for me <3. Thank you all for the help especially balala. :)
Glad to help, as always. Don't worry if you don't know how to achieve different things, just keep working, if you like Rainmeter. It's an exceptional piece of software and you gonna find a lot of very good solutions over time if you keep working.
Good work, congratulations. Feel free to post questions, if you have any.
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: 12112
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!