-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
93 lines (85 loc) · 3 KB
/
main.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import time
import mouse
def setPosition_mouse():
global other
if other:
print("Position saved: " + str(mouse.get_position()[0]) + "," + str(mouse.get_position()[1]))
position.append(mouse.get_position()[0])
position.append(mouse.get_position()[1])
position.append(input("time: "))
temp = input("Other movement(Y/N): ")
if temp == 'N':
other = False
def setPosition_():
global other
if other:
position.append(int(input("Insert position x: ")))
position.append(int(input("Insert position y: ")))
position.append(input("time: "))
print("Position saved: " + str(position[len(position)-3]) + "," + str(position[len(position)-2]))
temp = input("Other movement(Y/N): ")
if temp == 'N':
other = False
position = []
i = 0
other = True
choose = ""
repeat = True
while (choose != "E"):
choose = input("Insert position/set position with mouse/Exit(I/M/E)")
other = True
repeat = True
i = 0
position = []
if (choose == "M"):
mouse.on_middle_click(lambda: setPosition_mouse())
while other:
if other == False:
break;
mouse.unhook_all()
while (repeat == True):
number_movements = input("Number movements: ")
time_movements = input("Time between movements: ")
k = 0
time.sleep(5)
while (k < int(number_movements)):
j = 0
while j < len(position):
mouse.move(position[j] - mouse.get_position()[0], position[j + 1] - mouse.get_position()[1],
absolute=False,
duration=0.2)
mouse.click()
time.sleep(float(position[j + 2]))
j = j + 3
time.sleep(float(time_movements))
k = k + 1
temp = input("Do you want repeat?(Y/N): ")
if temp == 'N':
repeat = False
elif (choose == "E"):
break;
else:
while other:
setPosition_()
if other == False:
break;
while (repeat == True):
number_movements = input("Number movements: ")
time_movements = input("Time between movements: ")
k = 0
time.sleep(5)
while (k < int(number_movements)):
print("Start")
j = 0
while j < len(position):
mouse.move(position[j] - mouse.get_position()[0], position[j + 1] - mouse.get_position()[1],
absolute=False,
duration=0.2)
mouse.click()
time.sleep(float(position[j + 2]))
j = j + 3
time.sleep(float(time_movements))
k = k + 1
temp = input("Do you want repeat?(Y/N): ")
if temp == 'N':
repeat = False