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

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

Help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 21470
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

Krainz wrote:Any ideas on how to make this limit work? For me not even the one that stops it from going negative is working, which should be this one, posted above:

It feels like I'm forgetting something. Maybe DynamicVariables?
Not sure, I assume if you create a skin using exactly my code above, it works?
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am

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

Post by Krainz »

Yeah, I always use your exact code to test, and it didn't stop at 0. Did it work for you?
User avatar
jsmorley
Developer
Posts: 21470
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

Krainz wrote:Yeah, I always use your exact code to test, and it didn't stop at 0. Did it work for you?
It sure does. Make sure you are running a recent version of Rainmeter. I would recommend the latest beta from http://rainmeter.net.

Code: Select all

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

[ClickLeftCounter]
Measure=Calc
Formula=ClickLeftCounter + 1
Disabled=1
UpdateDivider=-1
OnUpdateAction=[!SetOption CurrentX Formula "([CurrentX] + 1)"][!UpdateMeasure CurrentX][!UpdateMeter *][!Redraw]

[ClickRightCounter]
Measure=Calc
Formula=ClickRightCounter + 1
Disabled=1
UpdateDivider=-1
OnUpdateAction=[!SetOption CurrentX Formula "([CurrentX] - 1)"][!UpdateMeasure CurrentX][!UpdateMeter *][!Redraw]

[CurrentX]
Measure=Calc
Formula=0
UpdateDivider=-1
IfCondition=CurrentX < 0
IfTrueAction=[!SetOption CurrentX Formula "0"][!UpdateMeasure CurrentX][!UpdateMeter *][!Redraw]

[MeterImage]
Meter=Image
W=50
H=50
X=[CurrentX]
Y=0
SolidColor=152,235,131,255
DynamicVariables=1

[ShowClicks]
Meter=String
X=0r
Y=0R
FontColor=255,255,255,255
FontFace=Segoe UI
FontSize=17
StringEffect=Shadow
FontEffectColor=0,0,0,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Left: [ClickLeftCounter] Right: [ClickRightCounter] CurrentX: [CurrentX]
DynamicVariables=1
LeftMouseUpAction=[!EnableMeasure ClickLeftCounter][!UpdateMeasure ClickLeftCounter]
RightMouseUpAction=[!EnableMeasure ClickRightCounter][!UpdateMeasure ClickRightCounter]
test.gif
You do not have the required permissions to view the files attached to this post.
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am

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

Post by Krainz »

Yeah, installing the beta version made it work. Thanks! :yahoo:
User avatar
mattnicholas
Posts: 3
Joined: December 19th, 2020, 8:52 am

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

Post by mattnicholas »

hey.. firstly, thanks for this thread, it helped me a lot in making my own click counter in rainmeter. One last thing that I want to add little animation and design improvements that make the green square where user clicks look like a real button. I saw something exactly same on this click counter I am good with algorithms but not so good with design stuff. Can any of the bright minds here help me with this? Thanks in advance.
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 »

mattnicholas wrote: December 20th, 2020, 5:44 am I saw something exactly same on this click counter
This is not a Rainmeter skin, right?
mattnicholas wrote: December 20th, 2020, 5:44 am Can any of the bright minds here help me with this?
Since this topic is more than six years old, first please post the exact code you are using. Also let us know what exactly do you want to achieve, because I'm not exactly sure what does this mean:
mattnicholas wrote: December 20th, 2020, 5:44 am One last thing that I want to add little animation and design improvements that make the green square where user clicks look like a real button.
What kind of animation do you want? And what design improvements? Not sure...
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 »

mattnicholas wrote: December 20th, 2020, 5:44 am hey.. firstly, thanks for this thread...

Can any of the bright minds here help me with this? Thanks in advance.
I am pretty spiffy with photoshop - a rough as guts mspaint sketch and I'll try to make something you'll like - i hope. :oops:
Can't fix it if it ain't broke - unless it is in code.
User avatar
mattnicholas
Posts: 3
Joined: December 19th, 2020, 8:52 am

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

Post by mattnicholas »

CodeCode wrote: December 21st, 2020, 5:51 am I am pretty spiffy with photoshop - a rough as guts mspaint sketch and I'll try to make something you'll like - i hope. :oops:
I want to replicate the button like this one (including the pressing animation).
You do not have the required permissions to view the files attached to this post.
User avatar
mattnicholas
Posts: 3
Joined: December 19th, 2020, 8:52 am

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

Post by mattnicholas »

balala wrote: December 20th, 2020, 4:50 pm This is not a Rainmeter skin, right?

Since this topic is more than six years old, first please post the exact code you are using. Also let us know what exactly do you want to achieve, because I'm not exactly sure what does this mean:

What kind of animation do you want? And what design improvements? Not sure...
I just posted the GIF of how I want it. I am using the exact code provided by @jsmorley

Code: Select all

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

[ClickCounter]
Measure=Calc
Formula=ClickCounter+1
Disabled=1
UpdateDivider=-1

[ShowClicks]
Meter=String
MeasureName=ClickCounter
X=0
Y=0
FontColor=255,255,255,255
FontFace=Segoe UI
FontSize=17
StringEffect=Shadow
FontEffectColor=0,0,0,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Counter is: %1
LeftMouseUpAction=[!EnableMeasure ClickCounter][!UpdateMeasure ClickCounter][!UpdateMeter ShowClicks][!Redraw]
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 »

mattnicholas wrote: December 21st, 2020, 6:58 am I want to replicate the button like this one (including the pressing animation).
That's fairly basic. Using Shape meters for that should be better than using an image - that reduces dependencies for image files etc.

The toggle effect would simply be a similar shape being toggled using !togglemetergroup between the two shapes.

Give it a whirl, as I think you're up to the coding task of that desired effect. IIRC the Shape section of the manual uses a very similar example you can work from.
Can't fix it if it ain't broke - unless it is in code.