def maintainance(system, index): if index % 100 == 0: closef2.close() login.sign_in_toronto(username, password, system) if index > 500: closef2.restart_pc()
def traverse_menu( previous_menu, menu_str, system, attempt=0, ): if not f2.is_system_open(tries=25): login.sign_in_toronto(login.username, login.password, system) window_data = VERIFICATION['system'][system] if not f2.verify(window_data, attempts=50): login.sign_in_toronto(login.username, login.password, system) if attempt > 2: return False if previous_menu(system): window_data = VERIFICATION['screens'][menu_str] cmd = VERIFICATION['navigation'][menu_str] print(cmd) if '{' in cmd: keyboard.write_mix(cmd) else: keyboard.write_text(cmd) keyboard.enter(1) if not f2.verify(window_data, 50): return traverse_menu(previous_menu, menu_str, system, attempt=attempt + 1) return True return False
def main_menu(system): window_data = VERIFICATION['system'][system] if not f2.is_system_open(tries=25): login.sign_in_toronto(login.username, login.password, system) if not f2.verify(window_data, attempts=500): login.sign_in_toronto(login.username, login.password, system) main_menu_call() main_menu_call() return main_menu_call()
def system_loop(system, username, password, logged_in): if not logged_in: close_everything() if login.sign_in_toronto(username, password, system, attempts=0): logged_in = True else: get_data.check_priced_lots_bulk("12345", "test") jobs = tasks() while True: next_job = jobs.pop() if do_job(system, next_job): break else: print(next_job, 'job failed') return logged_in
# log into system if __name__ == '__main__': ### log in with only one F2 window open logged_in = False tries = 0 while not logged_in: tries += 1 username = f2_password['username'] password = f2_password['password'] system = 'f2_canada_real' closef2.close() print(f'Login Attempt: {tries}') if tries > 10: closef2.restart_pc() try: if login.sign_in_toronto(username, password, system, attempts=0): logged_in = True except pyautogui.FailSafeException: print("Corner exit Detected") exit() except: print('error') closef2.close() print("checking for database connection...") while True: # wait for database to open try: # if database isn't open yet wdfsill get error print("connecting to database") get_data.check_priced_lots_bulk("12345", "test")