Sign in to follow this  
Followers 0
Null33

Mouse Click Counter in Label

5 posts in this topic

Hi, first of all sorry for my english :P .

I want to make a counter of the left mouse button and I want that it is ever active until I press the Stop button and I want that a Label shows the numbers of clicks.

I write this:

#include 
#include 

Global $clicks
$clicks=1

$Form1 = GUICreate("Form1", 251, 134, -1, -1)
$Label1 = GUICtrlCreateLabel("Number = ", 24, 8, 196, 25)
$Button1 = GUICtrlCreateButton("Active", 24, 56, 201, 25, 0)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Func1()
EndSwitch
WEnd


Func _Func1()
While 1
If _IsPressed(01) Then
GUICtrlSetData($Label1, "Number = " & $clicks)
EndIf
if _IsPressed(01) Then
$clicks+=1
While _IsPressed(01)
Sleep(1)
WEnd
EndIf
WEnd
EndFunc

I don't know how to terminate it, and if I add MouseClick("left",x,x,x,x) it doesn't count the click of the mouse.

I want add this function in an AutoClick of the left button of the mouse, so I want to know how many times the left button is clicked.

I don't know if you understand :ermm:

Sorry again for my english. Thanks ;)

Share this post


Link to post
Share on other sites



I don't know why but it doesn't count the click of MouseClick, there is an other way to count the click?

Share this post


Link to post
Share on other sites

Hi, Null33. Posting your code seems to have stripped which files you're including, but you have only two, when you need three. You need GUIConstantsEX.au3 and WindowsConstants.au3 to create the GUI, and Misc.au3 for the _IsPressed function. When I include all three of these files, the code you have works and counts the mouse clicks just fine.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Problem solved ;)... thanks to all :D in particular thank JohnOne :thumbsup:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0