Created
September 5, 2011 08:20
-
-
Save falsetru/1194405 to your computer and use it in GitHub Desktop.
click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32api | |
import win32con | |
from time import sleep | |
import Image | |
import pywinauto | |
app = pywinauto.Application.start('mspaint') | |
win = app.top_window_() | |
win.MoveWindow(0,0) | |
def click(x,y): | |
win32api.SetCursorPos((x,y)) | |
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) | |
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) | |
im = Image.open(r'c:\a.png') | |
for i in range(im.size[0]): | |
for j in range(im.size[1]): | |
if im.getpixel((i, j)) < 200: | |
click(50+i, 200+j) | |
sleep(0.01) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment