Auto Clicker for Clicker Heroes

Purpose

Clicks over and over again while playing Clicker Heroes in Chrome.

Safety features:

  • Caps Lock must be toggled on
  • Active window title must contain “Clicker Heroes” and “Google Chrome”

Prevent resource hogging:

  • Only checks for Caps Lock once per second.

Code

AutoClicker.py

'''Clicks over and over again while playing Clicker Heroes in Chrome.
Safety features:
Caps Lock must be toggled on
Active window title must contain "Clicker Heroes" and "Google Chrome"
Prevent resource hogging:
Only checks for Caps Lock once per second
'''

import win32api, win32con, win32gui
#python -m pip install pypiwin32
import time

while True:
    time.sleep(0.01)
    capsLockOn = win32api.GetKeyState(win32con.VK_CAPITAL)
    if (capsLockOn == 1):
        topWinText = win32gui.GetWindowText(win32gui.GetForegroundWindow())
        if (("Clicker Heroes" in topWinText) and 
            ("Google Chrome" in topWinText)):
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0)
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0)
    else:
        time.sleep(1)

Download

Download AutoClicker.py

Download Executable Version (no Python needed)

License: MIT License: software as is, no warranty, and this license must always be included with this software:
https://kriscoder.com/licenses/MIT-LICENSE.txt

GitHub: https://github.com/kriscode1/AutoClicker

Build Info

Written in Python 3. Uses pypiwin32, so install “python -m pip install pypiwin32“.

To create the executable, I wrote a py2exe setup script. For more information on this technique, see How to Convert Python Scripts to Executables.

Usage

The Python script runs in a loop, so you can simply download and double click the .py file, or run it from command prompt using:

python AutoClicker.py

The executable can be ran without Python installed.

After opening the program, you will see a blank prompt. Then:

  1. Navigate to your Google Chrome window with Clicker Heroes open.
  2. Point your mouse where you want to click a lot.
  3. Turn on Caps Lock.

If you turn off Caps Lock, or the cursor is moved and it clicks off the browser window, then the script will stop clicking.

Disclaimer

Use at your own risk. If the script is against Clicker Heroes’ policy, then don’t use it. Also, don’t run any auto clicker program while you have important documents open or buttons that you shouldn’t click. The safety feature takes one bad click to activate. Feel free to modify the code however you’d like for yourself.

Leave a Reply

Your email address will not be published.