-
Notifications
You must be signed in to change notification settings - Fork 0
/
send_present_menu.py
27 lines (22 loc) · 955 Bytes
/
send_present_menu.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
from routine import Routine
from routine import RoutineException
from __init__ import *
class SendPresentMenu(Routine):
def __init__(self, index=0):
self._index = index
def execute(self) -> int:
locations = self._disablePauseFor_(
lambda: list(pyautogui.locateAllOnScreen(friend_send, confidence=0.92))
)
if (len(locations) == 0):
raise RoutineException("Could not find a single send button")
for i in range(Routine._command_retries_):
pyautogui.click(pyautogui.center(locations[self._index]))
_locations = self._disablePauseFor_(
lambda: list(pyautogui.locateAllOnScreen(friend_send, confidence=0.92))
)
if (len(_locations) == 0):
break
elif(i == Routine._command_retries_ - 1):
raise RoutineException("Could not click on send button")
return 0