optimized a bit for you quickly..
; Clickcounter By Dipan and lorenkinzel
Opt("GUIOnEventMode", 1)
Global $clicks, $goodToGo, $ifstop = 1, $GUI_EVENT_CLOSE = -3
$Form1 = GUICreate("ClickCounter", 317, 183, 350, 143)
GUISetOnEvent($GUI_EVENT_CLOSE, "xIt")
$label1 = GUICtrlCreateLabel("0", 148, 16, 90, 35)
GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman")
$buttonMinus = GUICtrlCreateButton("-", 16, 80, 49, 33)
GUICtrlSetOnEvent($buttonMinus, "subtractOne")
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$buttonPlus = GUICtrlCreateButton("+", 248, 80, 41, 33);remains for visual
GUICtrlSetOnEvent($buttonPlus, "plusOne")
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$buttonClear = GUICtrlCreateButton("Clear", 24, 144, 105, 25)
GUICtrlSetOnEvent($buttonClear, "resetToZero")
$buttonStart = GUICtrlCreateButton("start", 88, 80, 137, 33)
GUICtrlSetOnEvent($buttonStart, "start")
$buttonStop = GUICtrlCreateButton("stop", 184, 144, 105, 25)
GUICtrlSetOnEvent($buttonStop, "stop")
GUISetState(@SW_SHOW)
WinSetOnTop("ClickCounter", "", 1)
While 1
Sleep(10)
If _IsPressed(01) Then
_E()
EndIf
WEnd
Func _E();seandisanti 9-19-10
If _IsPressed("01") And $goodToGo = 1 Then
_WaitRelease()
addOne()
EndIf
EndFunc ;==>_E
Func xIt()
Exit
EndFunc ;==>xIt
Func start()
$goodToGo = 1
$ifstop = 0
EndFunc ;==>start
Func stop()
$goodToGo = 0
$clicks -= 1
$ifstop = 1
GUICtrlSetData($label1, $clicks)
EndFunc ;==>stop
Func addOne()
$clicks += 1
GUICtrlSetData($label1, $clicks)
EndFunc ;==>addOne
Func subtractOne()
If $goodToGo = 1 Then
$clicks -= 2
Else
$clicks -= 1
EndIf
GUICtrlSetData($label1, $clicks)
EndFunc ;==>subtractOne
Func resetToZero()
If $goodToGo = 1 Then
$clicks = -1
Else
$clicks = 0
EndIf
GUICtrlSetData($label1, $clicks)
EndFunc ;==>resetToZero
Func plusOne ()
if $ifstop = 1 then
$clicks += 1
GUICtrlSetData($label1, $clicks)
EndIf
EndFunc
Func _WaitRelease()
While _IsPressed(01)
Sleep(10)
WEnd
EndFunc ;==>_WaitRelease
Func _IsPressed($sHexKey, $vDLL = 'user32.dll')
Local $a_R = DllCall($vDLL, "int", "GetAsyncKeyState", "int", $sHexKey)
$Last = $sHexKey
If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
Return 0
EndFunc ;==>_IsPressed