def maintainance(system, index): if index % 100 == 0: closef2.close() login.sign_in_toronto(username, password, system) if index > 500: closef2.restart_pc()
def login(username, password): closef2.close() paths = [{ 'dir': r'c:/Program Files (x86)/Connect Internet/', 'filename': 'Connect.exe' }, { 'dir': r'c:/Program Files (x86)/Connect2000_Internet/', 'filename': 'Connect2000.exe' }] for path in paths: try: os.chdir(path['dir']) os.system(path['filename']) break except: print("not found") print(path) while not is_login_dialogue_open(): time.sleep(.1) keyboard.write_text(password) pyautogui.hotkey('shift', 'tab') keyboard.write_text(username) keyboard.enter()
# choose syste, if system == 'f2_canada_real': keyboard.write_text( VERIFICATION['system_options']['f2_canada_real_system_number']) window_data = VERIFICATION['system']['f2_canada_real'] elif system == 'f2_canada_test': keyboard.write_text( VERIFICATION['system_options']['f2_canada_test_system_number']) window_data = VERIFICATION['system']['f2_canada_test'] else: return False if not f2.verify(window_data, attempts=500): return sign_in_toronto(username, password, attempts + 1) window_data = VERIFICATION['screens']['main_menu'] if not f2.verify(window_data, attempts=500): return sign_in_toronto(username, password, attempts + 1) print('signed in') return True username = f2_password['username'] password = f2_password['password'] system = 'f2_canada_real' if __name__ == '__main__': for i in range(5): closef2.close() sign_in_toronto(username, password, system) closef2.close()
def close_everything(): closef2.close() closef2.close() closef2.close()