Last active
December 25, 2015 17:19
-
-
Save NickRSearcy/7012232 to your computer and use it in GitHub Desktop.
automate clicking over an area for a certain amount of time with python
This file contains hidden or 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 autopy | |
import time | |
from subprocess import call | |
start_location = [1540, 1004] | |
stop_location = [1790, 1121] | |
step = [20, 5] | |
delay = 0.001 | |
duration = 15*60 | |
start_time = time.time() | |
abort = False | |
while ( not abort ): | |
current_location = start_location | |
for x in range(start_location[0], stop_location[0], step[0] ): | |
for y in range(start_location[1], stop_location[1], step[1] ): | |
autopy.mouse.move( x, y ) | |
autopy.mouse.click() | |
time.sleep(delay) | |
pos = autopy.mouse.get_pos() | |
if (time.time() - start_time) > duration : | |
abort = True | |
elif pos[0] < start_location[0] : | |
abort = True | |
call("osascript -e \"set Volume 7\"", shell=True) | |
call(["say", "Hey! Nick, you should check on your computer" ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment