Skip to content

Instantly share code, notes, and snippets.

@karmatr0n
Last active November 26, 2021 04:11
Show Gist options
  • Save karmatr0n/51805428dfbfd4b763bda07bad86ea74 to your computer and use it in GitHub Desktop.
Save karmatr0n/51805428dfbfd4b763bda07bad86ea74 to your computer and use it in GitHub Desktop.
mm
do shell script "
/usr/bin/python <<END
import sys
import time
import random
from Quartz.CoreGraphics import *
def mouseEvent(type, x, y):
theEvent = CGEventCreateMouseEvent(None, type, (x,y), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mouseMove(x, y):
mouseEvent(kCGEventMouseMoved, x, y)
def mouseClick(x, y):
mouseEvent(kCGEventLeftMouseDown, x, y)
mouseEvent(kCGEventLeftMouseUp, x, y)
ourEvent = CGEventCreate(None)
currentpos = CGEventGetLocation(ourEvent)
while True:
r = random.randint(3, 10)
l = random.randint(0, 50)
x = random.randint(0, 100)
y = random.randint(0, 100)
for x in range(0, l):
mouseClick(x, y)
mouseMove(int(currentpos.x),int(currentpos.y))
time.sleep(r)
END"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment