import sys
import time
from Quartz import *
def createMouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
if __name__ == '__main__':
x = int(sys.argv[1])
y = int(sys.argv[2])
createMouseEvent(kCGEventLeftMouseDown, x, y);
createMouseEvent(kCGEventLeftMouseUp, x, y);
Usage:
python script.py 100 100
It'll move the mouse to (100, 100)
Here is the same script on github. click.py
I used the following sources
metapep's blogpost
pepijndevos's PyMouse
GeekOrgy's Python script
a stackoverflow entry
thanks!
Laser Galvo is also named as lase scanners, which are popular in the laser manufacturing industry.
ReplyDelete