/Pytomator

Vision-based Automation Python Module for OS X

Primary LanguagePythonOtherNOASSERTION

Pytomator

Pytomator

Vision-based Automation Python 2.7 Module for OS X

This Python module make use of OpenCV, NumPy and Quartz to control mouse and keyboard events automatically, [CV] 4'ing your OS X screen.

Pre-requisites

In order to compile Pytomator you must be on OS X 10.8 or higher and have OpenCV installed on your machine.

Install OpenCV (with Homebrew)

Run

$ brew install opencv

Then follow the instructions given by Homebrew.

Installation

To install pytomator run

$ sudo pip install git+git://github.com/danieleciriello/Pytomator

Basic Usage

Add this lines to your file to add pytomator to your Python module

from pytomator import pytomator

You must provide an image to the match function, which return the center coordinates of the matched area, you can then click, drag, or move the mouse at such coordinates.

x, y = pytomator.match(template_path)
pytomator.mouseclick_visive(x, y)

You can control key pressing events in this way

for c in 'spam':
    pytomator.keyboard.press_key(c)
    pytomator.keyboard.release_key(c)

License

Copyright (c) 2014 Daniele Ciriello

See LICENSE.txt for license information.

Notes