-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
62 lines (52 loc) · 1.57 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
import pyautogui
import keyboard
import time
import winsound as sd
def beepsound():
fr = 2000 # range : 37 ~ 32767
du = 500 # 0.5 second
sd.Beep(fr, du) # winsound.Beep(frequency, duration)
def reserve():
reservation = pyautogui.locateCenterOnScreen('reservation.png')
pyautogui.click(reservation[0], reservation[1])
pyautogui.PAUSE = 1
pyautogui.FAILSAFE = True
#time.sleep(1)
#pyautogui.screenshot('refresh.png', region=(1560,857,30,30))
while True:
if keyboard.is_pressed('S'):
beepsound()
break
refresh_location = pyautogui.locateCenterOnScreen('refresh.png')
pyautogui.click(refresh_location[0], refresh_location[1])
while True:
if keyboard.is_pressed('E'):
beepsound()
break
red = pyautogui.locateCenterOnScreen('red.png')
blue = pyautogui.locateCenterOnScreen('blue.png')
green = pyautogui.locateCenterOnScreen('green.png')
#test = pyautogui.locateCenterOnScreen('test.png')
if red or blue or green:
print(red, blue, green)
beepsound()
#if test:
# pyautogui.click(test[0],test[1])
# reserve()
# break
if red:
pyautogui.click(red[0], red[1])
reserve()
break
elif blue:
pyautogui.click(blue[0], blue[1])
reserve()
break
elif green:
pyautogui.click(green[0], green[1])
reserve()
break
if keyboard.is_pressed('E'):
beepsound()
break
pyautogui.click(refresh_location[0], refresh_location[1])