AutoIt simple Repeat mouse click Script

How to create a script to repeatedly click spots on the screen, until a exit hotkey is pressed.

By. BlueBoden

AutoIt Logo

AutoIt is one of the easier scripting languages to learn, and automating tasks in windows can be very useful. This is a basic script i made to repeatedly click a spot on the screen, but this can easily get extended to click multiple spots.

What many beginners find hard, is how to create their first loop, and how to end the Script with a hotkey. Of cause these are documented in the help file as well, but now You'll have this for your reference to.

The full script is shown below. Watch out that it doesn't click a icon on your desktop, and that you don't accidentally start a bunch of instances of the same program.

#comments-start

 AutoIt Version: 3.3.6.1
 Author:         BlueBoden

 Script Function:
	This Script will repeatedly click a spot on the screen until stopped.

 The exit hotkey for this script is CTRL+ALT+x

#comments-end

;Assigns the HotKey to our custom exit function
HotKeySet("^!x", "MyExit")

; The coordinates to click in pixels
$x = 200
$y = 150


$i = 0
While $i <= 10
  MouseClick("left", $x, $y, 1)

  ; Uncomment the below line to make the script click only 10 times, or until the hotkey is pressed.
   ; $i = $i + 1
  ; Uncomment the below line to make the script pause between clicks, the value is in milliseconds
   ; Sleep(5000)
WEnd

Func MyExit()
  Exit 
EndFunc