Trying to loop a mouseclicks until

03/25/2015 18:23 Gundogan#1
So basicly im trying to make a autoclicker, just a small starter project :/
But when i try to do the $Var = $Var + 1 it errors and exits..

Here's some of my code

Code:
Global $i = 0

Func etinputfunc()
   Do
	  Mouseclick("Left")
	  Sleep($Input1)
	  $i = $i + 1
   Until $i = 10000
EndFunc
The Error:
"C:\Users\ChristianPC\Dropbox\My Autoclicker\GUI ting.au3" (47) : ==> Variable used without being declared.:
$i = $i + 1
$i = ^ ERROR
>Exit code: 1 Time: 1.105


If someone has an idea of what i need to do, please help me :)
- Thanks
03/25/2015 18:42 alpines#2
You maybe call the function before the variable is initialized. Also I assume that you have a Control-ID inside $Input1, so if you want to read the value of that Input-Controls use GUICtrlRead($Input1)
03/25/2015 20:54 fear-x#3
Code:
Global $i = 0,$Input1 ; forgot to define the input

;#example
;Case $_Button ; just a button event to call function
         $ = 0
         etinputfunc()
;#

Func etinputfunc()
   Do
	  Mouseclick("Left")
	  Sleep(GUICtrlRead($Input1)) ;you must use GUICTRLREAD to get value of input from gui. or otherwise
                                                  ;you must set a value to your $Input1 variable like $Input = 1000
	  ;$i = $i + 1 ; you can do this a differnt way too
          $i += 1 ;this is the other shorter/quicker way..
   Until $i = 10000
EndFunc
have fun :_)