-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmouse.py
42 lines (33 loc) · 817 Bytes
/
mouse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from pymouse import PyMouse
import sys
import gtk
m = PyMouse()
def MouseClick(x,y,event):
if event == 2:
event = 3
elif event == 3:
event = 2
elif event == -2:
event = -3
elif event == -3:
event = -2
if event>0:
m.press(x, y, event)
else:
m.release(x,y,abs(event))
def MouseGo(x,y):
m.move(x,y)
arguments= sys.argv
arguments = [int(float(x)) for x in arguments[1:]]
width = gtk.gdk.screen_width()
height = gtk.gdk.screen_height()
if len(arguments) == 0:
pass
elif arguments[0] == 0:
arguments[1] = int((arguments[1] * width)/1000.0)
arguments[2] = int((arguments[2] * height)/1000.0)
MouseGo(arguments[1],arguments[2])
elif arguments[0] == 1:
arguments[1] = (arguments[1] * width)/1000
arguments[2] = (arguments[2] * height)/1000
MouseClick(arguments[1],arguments[2],arguments[3])