Nikitenko Maxim (Sets88)

Personal page

Python - Autoclicker

Recently, one of my friend told me how it's hard for him in some MMO game to craft some things, he had to click button a thousands times, then I told him i can help him with his problem, all i have to do is computer have to automaticaly click for him, all he have to do then is relax and drink his coffee, and see how life in game is getting better :)

To avoid a antibot system which can find his behavier behavior as a cheating, i added random intervals between clicks.

For my friend I builded this script as a standalone exe file using py2exe.

To use this script you need Python and pymouse module installed

Source code:
#!/usr/bin/python

from pymouse import PyMouse
import time
import random
import argparse
import signal
import sys


def main():
    parser = argparse.ArgumentParser(description='')
    parser.add_argument('-t', metavar='TIMEOUT', type=int, default=1000, help='Set clicking timeout (in miliseconds 1000ms = 1s)(Default = 1000)')
    parser.add_argument('-r', metavar='RANDOMTO', type=int, default=0, help='Randomly add or sub random time (in miliseconds 1000ms = 1s)(Default = 0)')
    parser.add_argument('-f', action='store_true', help='Follow the mouse while clicking(Off by default)')
    args = parser.parse_args()

    timeout = args.t
    rand = args.r

    m = PyMouse()
    x, y = m.position()
    while 1:
        time.sleep(sleeptime(timeout, rand))
        if args.f:
            x, y = m.position()
            if sys.platform == 'win32':
                m.press(x, y)
            else:
                m.click(x, y)
        else:
            x1, y1 = m.position()
            if sys.platform == 'win32':
                m.press(x, y)
            else:
                m.click(x, y)
            m.move(x1, y1)


def sleeptime(timeout, rand):
    r = random.randint(0, rand)
    if random.randint(0, 1):
        return (timeout / 1000.0 + r / 1000.0)
    else:
        return (timeout / 1000.0 - r / 1000.0)


def signal_exit(signal, frame):
    sys.exit(0)


if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal_exit)
    main()

Яндекс.Метрика