1
|
|
2
|
|
3
|
from Quartz.CoreGraphics import CGEventCreateMouseEvent
|
4
|
from Quartz.CoreGraphics import CGEventPost
|
5
|
from Quartz.CoreGraphics import kCGEventMouseMoved
|
6
|
from Quartz.CoreGraphics import kCGEventLeftMouseDown
|
7
|
from Quartz.CoreGraphics import kCGEventLeftMouseDown
|
8
|
from Quartz.CoreGraphics import kCGEventLeftMouseUp
|
9
|
from Quartz.CoreGraphics import kCGMouseButtonLeft
|
10
|
from Quartz.CoreGraphics import kCGHIDEventTap
|
11
|
from time import sleep
|
12
|
|
13
|
class macMouse():
|
14
|
def mouseEvent(self,type, posx, posy):
|
15
|
theEvent = CGEventCreateMouseEvent(None,type,(posx,posy),kCGMouseButtonLeft)
|
16
|
CGEventPost(kCGHIDEventTap, theEvent)
|
17
|
|
18
|
def mousemove(self,posx,posy):
|
19
|
self.mouseEvent(kCGEventMouseMoved, posx,posy);
|
20
|
|
21
|
def mouseclick(self,posx,posy):
|
22
|
self.mouseEvent(kCGEventLeftMouseDown, posx,posy);
|
23
|
self.mouseEvent(kCGEventLeftMouseUp, posx,posy);
|
24
|
|
25
|
mMouse = macMouse()
|
26
|
mMouse.mouseclick(650,170)
|
27
|
|
28
|
|
29
|
|
30
|
|