def collect_weights(): matrix_xoff = int(scalex * 20) matrix_yoff = int(scaley * 150) xdelta = int(scalex * 152) ydelta = int(scaley * 140) im = Image.open("tobii_alpha_1600x900.jpg") imrs = im.resize((int(scalex * 1059), int(scaley * 700))) imrs.save("tobii_alphabet_scaled.png") width, height = imrs.size print("width is", width, " and height is", height) curr_desktop = os.environ['USERPROFILE'] + '\Desktop' process_st = subprocess.Popen([ '..\python3\Release\SpriteWithTimer.exe', 'tobii_alphabet_scaled.png', str(width), str(height) ]) time.sleep(1) # update_display_new_page("tobii_alphabet_scaled.png",width,height) dx_app = Application().connect(process=process_st.pid) # time.sleep(1) for i in range(0, 28): row = int(i / 7) col = (i % 7) msg = "Alter_coordxy," + str(i + 1) + "," + str( col * xdelta + matrix_xoff) + "," + str(row * ydelta + matrix_yoff) netv_send(msg) dx_app.top_window().set_focus() start_bci2000("weights_directx_28.prm") dx_app.top_window().set_focus() exit(1)
def acro(path): os.system('start acrobat ' + path + '/' + path + '.pdf') sleep(1) #Change the path to point to your acrobat. If you dont know what this is,please refer to readme file app = Application(backend='uia').connect( path=r"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat") sleep(1) dlg = app.top_window() SendKeys("{VK_MENU}") sleep(1) SendKeys("f") sleep(1) SendKeys("t") sleep(1) SendKeys("s") sleep(1) SendKeys("e") sleep(2) dlg.save.click() sleep(3) dlg.close() sleep(3) #Change the path to point to your excel. If you don't have excel installed just uncomment this part. app = Application(backend='uia').connect( path=r"C:\Program Files (x86)\Microsoft Office\root\Office16\excel.exe" ) dlg = app.top_window() dlg.close()
def _startup_app(self): os.startfile(Config.teleatt) try: from pywinauto.application import Application app = Application().connect(title_re='Version Choose', timeout=3) app.top_window().set_focus() app.top_window().OK.click() app.window(title_re="TeleATT").minimize() except Exception: Config.logger.error(tool.errorencode(traceback.format_exc()))
def saveToExcel(path): os.system("start WINWORD " + path + '/' + path + '.pdf') time.sleep(6) app = Application(backend='uia').connect( path= r"C:\Program Files (x86)\Microsoft Office\root\Office16\winword.exe") print('finished connecting') dlg = app.top_window() dlg.save.click() time.sleep(3) #dlg.ComboBox2.expand() #dlg.SaveDialogLabel.set_text('PDF') #print(dlg.ComboBox.item_count()) #print(dlg.ComboBox2.expand().item_count()) #dlg.ComboBox2.select('PDF') time.sleep(3) dlg.save.click() time.sleep(3) dlg.close() time.sleep(3) #extract(filename= path +'.docx', format="csv") os.system("soffice --convert-to html " + path + '/' + path + '.docx') os.system("move " + path + '.html ' + path) df = pd.read_html(path + '/' + path + '.html') table = df[0] table.to_csv(path + '/' + path + '.csv', index=False)
def makeWorkingAppInstance(self, commandList): # helper pipe to flush popen self.DEVNULL = open(os.devnull, 'w') # get the hwnds of windows now desktopInstance = Desktop(backend="win32") hwnds = [] for window in desktopInstance.windows(): # get the hwnd as an int hwnds.append(int(window.handle)) # start the instance now # sill be used many times throughout this function appInstance = Application(backend="win32") # first things first, lets try to create one from scratch self.pid = subprocess.Popen(commandList, stdout=self.DEVNULL).pid appInstance.connect(process=self.pid) if len(appInstance.windows()) != 0: # the app we created has some windows, we are done self.usedExisting = True self.mainWindow = appInstance.top_window() self.mainWindow.wait("enabled") # It worked return True else: # maybe use best_match=commandList[0].split(".")[0] # we have to search through existing windows # TODO no new windows appear for some reason for window in desktopInstance.windows(): if int(window.handle) not in hwnds: self.usedExisting = False self.mainWindow = window # break out of function return True # if it reached here, nothing has been found return False
def set_window_top_and_sendkey_1(self): '''把sh2的copy focus并sendkey''' while 1: if self.clickWindow: try: # wd1 = Application().connect(title_re=SH2_EXCEL_NAME,timeout=1) wd2 = Application().connect(title_re=SH2_COPY_TITLE_NAME,timeout=1) pcp.copy(self.sh2_1_daikinou_name) time.sleep(1) x = win32api.GetSystemMetrics(win32con.SM_CXSCREEN) y = win32api.GetSystemMetrics(win32con.SM_CYSCREEN) mouse.click(button='left',coords=(x-100,y-200)) # wd1.top_window().set_focus() time.sleep(1) dlg = wd2.top_window() dlg.set_focus() time.sleep(1) dlg.Edit.set_edit_text(self.sh2_1_daikinou_name) dlg.Button0.click() self.clickWindow = False except: print('[OK] Excel - 2.xlsm 窗口置顶等待中...') time.sleep(1)
def call_window_active(window_title): n = str(window_title) n = str(re.sub("[^0-9]", "", n)) # pp(n) try: w_handle = pywinauto.findwindows.find_windows( title=n, class_name='wcl_manager1', backend='uia')[0] app = Application().connect(handle=w_handle) call_dlg = app.top_window() actionable_dlg = call_dlg.wait("exists enabled visible ready") ids = call_dlg.pp_ctrl_ids # needs to sleep for 1 second for some reason. time.sleep(1) # SetForegroundWindow(call_dlg.wrapper_object()) x = 1 # pp('Must be on a call') return x except IndexError: x = 0 # pp('Looking for the call window') time.sleep(1) return x
def run(self): tool_app = Application(backend='uia') tool_app.connect(class_name='Shell_TrayWnd') tool_dlg = tool_app.window(class_name='Shell_TrayWnd') notify_dlg = tool_dlg.window(title='알림 펼침') notify_dlg.click_input() notify_dlg.click_input() notify_dlg.click_input() popup_dlg = tool_app.top_window() rect = popup_dlg.rectangle() row = int(rect.height() / 40) column = int(rect.width() / 40) ox = rect.left + 20 oy = rect.top + 20 for y in range(row): for x in range(column): pywinauto.mouse.move((ox + x * 40, oy + y * 40)) kiwoom_dlg = popup_dlg.window(title='서버와 통신이 연결 되었습니다..') kiwoom_dlg.right_click_input() pywinauto.keyboard.send_keys('{DOWN}') pywinauto.keyboard.send_keys('{ENTER}') password_app = Application(backend='win32') password_app.connect(title_re='계좌비밀번호.*') password_dlg = password_app.window(title_re='계좌비밀번호.*') password_edit_dlg = password_dlg.window(class_name='Edit') password_edit_dlg.set_focus() password_edit_dlg.type_keys(self.account_password) password_reg_dlg = password_dlg.window(title='등록') password_reg_dlg.click_input() password_dlg.window(title='닫기').click_input() self.event_loop.exit()
def main(argv): driver = test_util.create_chrome_webdriver() try: application = Application(backend="uia") application.connect(title_re='.*Chrome|.*Chromium') w = application.top_window() for desc in w.descendants(): print "item: %s" % desc print "Closing info bar." container = w.child_window(best_match="Infobar Container") container.child_window(best_match="Close").click_input() print "press F11 to enter full screen mode." w.type_keys('{F11}') window_rect = w.rectangle() window_width = window_rect.width() window_height = window_rect.height() content_width = driver.execute_script("return window.innerWidth") content_height = driver.execute_script("return window.innerHeight") # The content area should be the same size as the full window. print "window_rect: %s" % window_rect print "window_width: %s" % window_width print "window_height: %s" % window_height print "content_width: %s" % content_width print "content_height: %s" % content_height fs = window_width == content_width and window_height == content_height print "FullscreenAllowed: %s" % fs finally: driver.quit()
def connect_game_window(world): app = Application().connect(title_re="Minecraft 1.*", class_name="GLFW30") dlg = app.top_window() dlg.set_keyboard_focus() dlg.type_keys("{TAB}{ENTER}") time.sleep(0.2) print(f"connected to game window, loading world \"{world}\"...") load_world(dlg, world)
def dops_toweb(): '''操作photoshop''' app = Application().connect(class_name="Photoshop", title="Adobe Photoshop CC 2019") win = app.top_window() win.type_keys("%f") win.type_keys("ub") win.type_keys("{ENTER}") win.minimize()
def copy_and_past(): """It is required to have a notepad window already open. When passing in the file name, just pass in 'TextName' and don't pass in '- Notepad or .txt' """ document_name = input("What is the name of your file?: ") app = Application().connect( title=f'{document_name} - Notepad', class_name="Notepad" ) # Connect is used to set what application is running. # Basically connecting the program to the application app.top_window().set_focus() rect = app.window(title=f'{document_name} - Notepad', found_index=0) # Get the program by named rect.move_window(x=0, y=0) # Moves the window to top left of screen pyautogui.moveTo(100, 200) # moves the mous to 100, 200 click() # clicks the mouse on the open app pyautogui.hotkey('ctrl', 'a', interval=0.10) # select all pyautogui.hotkey('ctrl', 'c', interval=0.1) # copy all that was selected print(pyperclip.paste()) # print out what was copied
class TestSuite_z_opening_file(unittest.TestCase): path = 'c:\\Users\\an.kravets\\Desktop' path_win7 = 'C:\\Users\\root\\Desktop\\' def find_window(self, window): for i in range(20): if FindWindow(window, window) != None: return True else: time.sleep(0.5) return False def setUp(self): self.app = None def tearDown(self): #self.app.top_window().close() self.app.kill() #@unittest.skip('pass') def test_zb_open_metadata_file(self): #os.startfile(self.path + '\MetaData_File.pdf') #subprocess.Popen("%s %s" % (TestSuite_settings.path_to_app, self.path+'\MetaData_File.pdf')) subprocess.Popen("%s %s" % (TestSuite_settings.path_to_app_win_7, self.path_win7+'\MetaData_File.pdf')) time.sleep(2) self.find_window('Печать') time.sleep(1) handle = GetForegroundWindow() self.app = Application().connect(handle = handle) #time.sleep(1) self.app.top_window().wait('ready', 10, 0.5) first_element = 0 assert self.app.top_window().texts()[first_element] in 'Печать' assert self.app.top_window()['&Имя:ComboBox'].SelectedText()[first_element] in 'Fax' #@unittest.skip('pass') def test_zc_open_file_without_metadata(self): #subprocess.Popen("%s %s" % (TestSuite_settings.path_to_app, self.path+'\File.pdf')) subprocess.Popen("%s %s" % (TestSuite_settings.path_to_app_win_7, self.path_win7+'\File.pdf')) self.find_window('File.pdf - Adobe Acrobat Reader DC') time.sleep(1) handle = GetForegroundWindow() self.app = Application().connect(handle=handle) #time.sleep(1) self.app.top_window().wait('ready', 10, 0.5) first_element = 0 assert self.app.top_window().texts()[first_element] in 'File.pdf - Adobe Acrobat Reader DC'
def set_window_top_and_sendkey_2(self): '''把sh3的网线check focus并sendkey''' while 1: if self.sh3CheckButtonFlag: try: wd2 = Application().connect(title_re=SH3_CHECK_TITLE_NAME,timeout=1) x = win32api.GetSystemMetrics(win32con.SM_CXSCREEN) y = win32api.GetSystemMetrics(win32con.SM_CYSCREEN) mouse.click(button='left',coords=(x-100,y-200)) # wd1.top_window().set_focus() time.sleep(1) wd2.top_window().set_focus() time.sleep(1) send_keys('n') self.sh3CheckButtonFlag = False except: print('3.xlsm窗口置顶等待中...') time.sleep(1)
def setUp(self): """Set some data and ensure the application is in the state we want""" Timings.Defaults() self.tm = _ready_timeout app = Application(backend='win32') app.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"), wait_for_idle = False) self.app = app self.dlg = app.top_window() self.dlg.Wait('ready', timeout=self.tm)
def open_minecraft(path, world, launcher_delay, game_delay): app = Application().start(path) print(f"Started launcher at {path}, waiting {launcher_delay} seconds for it to load...") time.sleep(launcher_delay) dlg = app.top_window() dlg.set_keyboard_focus() dlg.type_keys("{TAB 11}{ENTER}") print(f"Starting game, waiting {game_delay} seconds before attempting to connect...") time.sleep(game_delay) connect_game_window(world)
def save_file(window_name, filename, save_dir="./SublimeSaveTemp", minimize=False, notification=False): """ Auto file saver for Sublime Text Args: window_name (str): The name of the file to be saved (it can be a partial name) filename (str): Name of the file once it's saved. save_dir (str): Directory where the file will be saved. minimize (bool): Tells if sublime text shall be minimized after the operation is completed. notification (bool): Tells the user before and after saving in order to eliminate most error risks Returns: Nothing. """ notif = Notifier() #Warns the user 2 seconds before the saving if activated if notification: notif.show_toast("File \"{}\" saving in 3 seconds".format(window_name), "Please stop typing/clicking", duration=3) app = Application().connect( path=r"C:\Program Files (x86)\Sublime Text 3\sublime_text.exe") first_window = str(app.windows()[0]).split("'")[1] app_dialog = app.top_window() #Gets window focus if needed if app_dialog.has_keyboard_focus() == False: app_dialog.minimize() app_dialog.restore() #Saves everything if find_tab(app, window_name): save_to_file(save_dir, filename, get_text()) if notification: notif.show_toast("File \"{}\" saved".format(window_name), "Go on and have fun!", threaded=True, duration=2) if find_tab(app, first_window) == False: #Returns to the first tab print("ERROR: Could not return to the previous window") if minimize: app_dialog.minimize() else: print("ERROR: Could not save the file: \"{}\" not found".format( window_name))
def setUp(self): """Set some data and ensure the application is in the state we want""" Timings.defaults() self.tm = _ready_timeout app = Application(backend='win32') app.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"), wait_for_idle=False) self.app = app self.dlg = app.top_window() mouse.move((-500, 200)) # remove the mouse from the screen to avoid side effects self.dlg.wait('ready', timeout=self.tm)
def setUp(self): """Set some data and ensure the application is in the state we want""" Timings.Defaults() self.tm = _ready_timeout app = Application(backend='win32') app.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"), wait_for_idle=False) self.app = app self.dlg = app.top_window() self.dlg.Wait('ready', timeout=self.tm)
class Voiceroid2: TITLE_PATTERN = "VOICEROID2\\*?" CLASS_NAME = "Window" BACKEND = "uia" def __init__(self): self.app = Application(backend=self.BACKEND).connect(title_re=self.TITLE_PATTERN, class_name=self.CLASS_NAME) self._define_controls() self._pre_binding() def _define_controls(self): dlg = self.app.top_window() self.ref_edit = dlg.child_window(auto_id="TextBox") self.ref_play = dlg.child_window(auto_id="c").Button3 self.ref_save = dlg.child_window(auto_id="c").Button7 self.ref_filename = dlg.child_window(auto_id="1001", control_type="Edit") self.ref_done = dlg.child_window(auto_id="2", control_type="Button") def _pre_binding(self): # this may reduce talk latency self.control_edit = self.ref_edit.wrapper_object() self.control_play = self.ref_play.wrapper_object() self.control_save = self.ref_save.wrapper_object() def _set_text(self, speaker, sentence): self.control_edit.set_edit_text("%s>%s" % (speaker, sentence)) def _play_text(self): self.control_play.click() def _generate_filename(self, path, speaker, sentence): name = "[%s] [%s] %s (%d)" % (datetime.now().strftime("%y%m%d"), speaker, sentence[:8], len(sentence)) return os.path.join(path, name) def _save_speech(self, filename): self.control_save.click() control_filename = self.ref_filename.wrapper_object() control_filename.set_edit_text(filename) control_filename.type_keys("{ENTER}") self.ref_done.click() def talk(self, speaker, sentence): self._set_text(speaker, sentence) self._play_text() def export(self, speaker, sentence, path): filename = self._generate_filename(path, speaker, sentence) self._set_text(speaker, sentence) self._save_speech(filename) # voiceroid = Voiceroid2() # desktop_path = os.path.join(os.environ["HOMEPATH"], "Desktop") # voiceroid.export("東北きりたん(v1)", "私は今もうこうした保留顔というのの以上で参りですた。もし今朝が矛盾順もどうもその攻撃うんなりへするているませをは忠告しななて、そうにはなるないませますた。貧民を着ますものはもち場合にかつてうですだ。", desktop_path)
def start_app(): try: app = Application(backend="uia").start(GAMEPATH) except Exception as E: print("Couldn't start the app\n", E) return False dlg = app.top_window() play_button = dlg.child_window(title="Play!", auto_id="1", control_type="Button") play_button.click() time.sleep(5) return True
def process_the_file(self): if os.path.exists(self.path_models + "spec.csv"): os.remove(self.path_models + "spec.csv") os.chdir(self.path) app = Application(backend="win32").start("wkinet.exe") app.window().menu().get_menu_path("Файл")[0].sub_menu().get_menu_path( "Открыть")[0].click() dlg = app.top_window() dlg.Edit.set_edit_text("spec.kin") dlg["Открыть"].click_input() app.top_window().set_focus() sleep(0.5) send_keys("{F5}") sleep(4) app.top_window().menu_select("Окна->Решение 1") sleep(0.5) app.top_window().menu_select("Файл->Экспорт") app.top_window().set_focus() dlg = app.top_window() dlg.Edit.set_edit_text("spec.csv") dlg["Сохранить"].click_input() sleep(2) app.kill()
def getDomain(): _webURL = "" ### Hook onto Chrome and get current website Domain ### # Get Chrome Process -!Doesnt work with multiple Chrome instances open!- app = Application(backend='uia').connect(title_re='.*Google Chrome', visible_only=True) # Get Current active tab and Copy URL chrome = app.top_window() chrome.type_keys('{F6}') chrome.type_keys('^c') # Cut off end of URL, save remainder as Domain _webURL = GetData() _webDomain = "/".join(_webURL.split('/', 3)[:3]) return _webDomain
def goto_app(name): # app = Application().connect(path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe") # try: app = Application().connect(title_re=".*" + name.strip() + ".*") # except Exception as e: # print( "Error:: goto_app(): ", sys.exc_info()[0]) # os._exit(1) print("IS HERE") w = app.top_window() #bring window into foreground if w.has_style(win32defines.WS_MINIMIZE): # if minimized ShowWindow(w.wrapper_object(), 9) # restore window state else: SetForegroundWindow(w.wrapper_object()) #bring to front
def main(argv): driver = test_util.create_chrome_webdriver() try: application = Application(backend="uia") application.connect(title_re='.*Chrome|.*Chromium') print("Looking for apps shortcut...") for desc in application.top_window().descendants(): print(desc.window_text()) if "Apps" == desc.window_text(): print("TRUE") return print("FALSE") finally: driver.quit()
def fileUpload(client, pid, path, index = 0): if index > 0: client.find_element(By.XPATH, "/html/body/div[1]/main/div[3]/div/div[2]/div[1]/div/ul/li[{}]/div/div".format(index + 1)).click() else: client.find_element(By.XPATH, "/html/body/div[1]/main/div[3]/div/div[2]/div[1]/div/ul/li/div/div").click() time.sleep(1) app = Application().connect(process=pid) dlg = app.top_window() print "submitting path into fileopen:" + path + "\n" dlg["Edit"].set_text(path) time.sleep(2) dlg["Open"].click() try: app.Dialog.Open.Click() except: return time.sleep(2)
def control_time(): print(datetime.datetime.now()) appCmd = Application().connect(path=r"C:\windows\system32\cmd.exe") dialogRildo = appCmd.top_window() dialogRildo.maximize() pergunta1 = input('O que esteve fzendo durante este tempo?') print('Eu digitei::: ', pergunta1) print('Agora seria a hora de salvar!') # -------- MONGO DB client = MongoClient('localhost', 27017) db = client.self_awareness_database mainTrack_Collection = db.mainTrack temp = { "autor": "Nathan", "date":datetime.datetime.now(), "mainQuestion":pergunta1} temp_id = mainTrack.insert_one(temp).inserted_id print('sera que inseriu?? >> ' , temp_id)
def testClickCustomizeButton(self): "Test click on the 'show hidden icons' button" # Minimize to tray self.dlg.minimize() _wait_minimized(self.dlg) # Make sure that the hidden icons area is enabled orig_hid_state = _toggle_notification_area_icons( show_all=False, debug_img="%s_01" % (self.id()) ) # Run one more instance of the sample app # hopefully one of the icons moves into the hidden area app2 = Application() app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe")) dlg2 = app2.top_window() dlg2.wait('visible', timeout=self.tm) dlg2.minimize() _wait_minimized(dlg2) # Test click on "Show Hidden Icons" button taskbar.ShowHiddenIconsButton.click_input() niow_dlg = taskbar.explorer_app.window(class_name='NotifyIconOverflowWindow') niow_dlg.OverflowNotificationAreaToolbar.wait('ready', timeout=self.tm) niow_dlg.SysLink.click_input() nai = Desktop().window( title="Notification Area Icons", class_name="CabinetWClass" ) nai.wait('ready') origAlwaysShow = nai.CheckBox.get_check_state() if not origAlwaysShow: nai.CheckBox.click_input() nai.OK.click() # Restore Notification Area settings _toggle_notification_area_icons(show_all=orig_hid_state, debug_img="%s_02" % (self.id())) # close the second sample app dlg2.send_message(win32defines.WM_CLOSE)
def run(options): basename = options.basename number_spectra = options.number_spectra spectra_acquistion_time_s = options.spectra_acquistion_time_s program_path = r"C:\Program Files\ElementsView\30kV ElementsView.exe" app = Application(backend="win32").connect(path=program_path) print("Application connected") top_window = app.top_window() print(top_window.print_control_identifiers(depth=1)) # top_window.Button2.click() print(top_window.Button2.print_control_identifiers(depth=1)) for spectrum_id in range(1, number_spectra+1): print("Spectrum id: %i" % (spectrum_id)) top_window.wait("exists enabled visible ready") top_window.Button2.click() time.sleep(spectra_acquistion_time_s + ADDITIONAL_WAIT_TIME_s) top_window.menu_select("File -> Save") logging.info("File->Save") app.Comment.wait("exists enabled visible ready") logging.info(app.Comment.print_control_identifiers()) app.CommentEdit.Edit.SetEditText("auto script") app.Comment.OK.click() logging.info("Comment") app['Save As'].wait("exists enabled visible ready") logging.info(app['Save As'].print_control_identifiers(depth=2)) file_name = "%s_%i.elv" % (basename, spectrum_id) app['Save As'].Edit.SetEditText(file_name) app['Save As'].Save.click() logging.info("Save") logging.info("Done")
def launchTools(): global dlg, app, objexpl try: print("%s: Siebel Tools started.." % time.strftime("%d %b %Y %H:%M:%S", time.localtime())) app = Application().start(ToolsPath, timeout=ToolsLaunchTimeOut) #app = Application().connect(path=ToolsexePath) app[ToolsWinTitle].wait("exists enabled visible ready") except pywintime.TimeoutError as e: print("%s: timed out while launching Siebel Tools" % time.strftime("%d %b %Y %H:%M:%S", time.localtime())) raise e except: print("%s: error occured while launching Siebel Tools:" % time.strftime("%d %b %Y %H:%M:%S", time.localtime())) dlg = app.top_window() #dlg = app['Siebel Tools - Siebel Repository'] dlg.type_keys("^E") # to open Object Explorer objexpl = app.SiebelToolsSiebelRepository.ObjectExplorer1.TreeView.WrapperObject( ) #Object explorer window
def testClickHiddenIcon(self): """ Test minimizing a sample app into the hidden area of the tray and restoring the app back """ if is_x64_Python() != is_x64_OS(): # We don't run this test for mixed cases: # a 32-bit Python process can't interact with # a 64-bit explorer process (taskbar) and vice versa return # Make sure that the hidden icons area is enabled orig_hid_state = _toggle_notification_area_icons( show_all=False, debug_img="%s_01" % (self.id()) ) self.dlg.minimize() _wait_minimized(self.dlg) # Run one more instance of the sample app # hopefully one of the icons moves into the hidden area app2 = Application() app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe")) dlg2 = app2.top_window() dlg2.wait('visible', timeout=self.tm) dlg2.minimize() _wait_minimized(dlg2) # Click in the hidden area taskbar.explorer_app.wait_cpu_usage_lower(threshold=5, timeout=40) taskbar.ClickHiddenSystemTrayIcon('MFCTrayDemo', double=True) self.dlg.wait('visible', timeout=self.tm) # Restore Notification Area settings _toggle_notification_area_icons(show_all=orig_hid_state, debug_img="%s_02" % (self.id())) dlg2.send_message(win32defines.WM_CLOSE)