Пример #1
0
    def __get_grid_data(self):
        """ 获取grid里面的数据 """
        grid = self.main_wnd.window(control_id=0x417,
                                    class_name='CVirtualGridCtrl')

        grid.set_focus().right_click()  # 模拟右键
        #keyboard.SendKeys('c')  # 模拟发送C

        keyboard.SendKeys('{DOWN}')
        time.sleep(0.1)
        keyboard.SendKeys('{DOWN}')
        time.sleep(0.1)
        keyboard.SendKeys('{DOWN}')
        time.sleep(0.1)
        keyboard.SendKeys("{ENTER}")

        file_path = "tmp.png"
        self.app.top_window().window(control_id=0x965, class_name='Static').\
            CaptureAsImage().save(file_path)  # 保存验证码

        captcha_num = captcha_recognize(file_path)  # 识别验证码
        print("captcha result-->", captcha_num)
        self.app.top_window().window(control_id=0x964,
                                     class_name='Edit').set_text(
                                         captcha_num)  # 模拟输入验证码

        self.app.top_window().set_focus()
        keyboard.SendKeys("{ENTER}")  # 模拟发送enter,点击确定

        data = clipboard.GetData()
        df = pd.read_csv(io.StringIO(data), delimiter='\t', na_filter=False)
        return df.to_dict('records')
Пример #2
0
    def __trade(self, stock_no, price, amount):
        time.sleep(1)
        self.main_wnd.window(control_id=0x408, class_name="Edit").set_text(
            str(stock_no))  # 设置股票代码
        self.main_wnd.window(control_id=0x409,
                             class_name="Edit").set_text(str(price))  # 设置价格
        self.main_wnd.window(control_id=0x40A,
                             class_name="Edit").set_text(str(amount))  # 设置股数目
        time.sleep(1)
        self.main_wnd.window(control_id=0x3EE,
                             class_name="Button").click()  # 点击卖出or买入
        keyboard.SendKeys("{ENTER}")
        time.sleep(1)
        self.app.top_window().set_focus()
        time.sleep(1)

        #        keyboard.SendKeys("{ENTER}")
        self.app.top_window().window(control_id=0x6,
                                     class_name='Button').click()  # 二次确认
        keyboard.SendKeys("y")
        time.sleep(1)
        result = self.app.top_window().window(
            control_id=0x3EC, class_name='Static').window_text()
        try:
            self.app.top_window().set_focus()
            keyboard.SendKeys("{ENTER}")
            #self.app.top_window().window(control_id=0x2, class_name='Button').click()  # 确定买入成功的结果
        except:
            pass
        return self.__parse_result(result)
Пример #3
0
def selectPicture(filepath):
    wait = WebDriverWait(driver, 10)
    element = wait.until(
        EC.element_to_be_clickable(
            (By.CLASS_NAME, "device-image-btn-browse"))).click()
    sleep(2)
    keyboard.SendKeys(filepath)
    keyboard.SendKeys('{ENTER}')
    sleep(1)
Пример #4
0
def close_share_window(zoom_window):
    # time.sleep(3)
    # 关闭分享
    # keyboard.SendKeys('%s')
    SetForegroundWindow(zoom_window)
    keyboard.SendKeys('%{F4}')
    time.sleep(1)
    # 确认关闭分享
    keyboard.SendKeys('{SPACE}')
Пример #5
0
    def GetDefGroup(self):
        try:
            row = self.ui.tableWidget.currentRow()
            item = self.ui.tableWidget.item(row, 2)
            if item:   # checks does cell contain information
                self.initialSetUp()
                keyboard.SendKeys('{VK_TAB}')
                self.ui.statusbar.showMessage(str(row)+'-------'+str(item.text()), 3000)
                defGroup = str(item.text())
                if (len(defGroup))<8:
	                defGroup = defGroup+' '*(8-len(defGroup))
                self._clipboardUpdate(defGroup)
                keyboard.SendKeys(r'^v')
                keyboard.SendKeys('{VK_TAB}')
                self._clipboardUpdate('d')
                keyboard.SendKeys(r'^v')
                keyboard.SendKeys('{ENTER}')
                sleep(2)
                keyboard.SendKeys('{ENTER}')
                sleep(2)
                keyboard.SendKeys(r'^a')
                keyboard.SendKeys(r'^c')
                data = self._clipboardGet()
                ind = (data.find('DEFAULT-GROUP=')+14)
                item = QtWidgets.QTableWidgetItem()
                item.setText(data[ind:ind+9].rstrip())
                self.ui.tableWidget.setItem(row, 3, item)
            else:
                pass
        except Exception:
            pass
Пример #6
0
 def press_enter():
   #press enter instead of clicking on the element because click() blocks
   spec_dlg = Desktop(backend="uia")["Login"]
   spec_dlg.set_focus()
   #restore is a cheap hack to select the window
   spec_dlg.restore()
   keyboard.SendKeys('{ENTER}')
Пример #7
0
def handle_dismiss(title, dlgwd):
	# handles the alert that happens in this specific case and dismisses it. Handle is to be tailored to its specific job. TODO: Maybe more functionality
	dlg = Desktop(backend="uia")['%s' %title]
	dlg[dlgwd].set_focus()
	#dlg.restore()
	keyboard.SendKeys("{VK_ESCAPE}")
	print "handle-function finished"
Пример #8
0
    def youtube_attack(self, repetitions, video_name, google_query):
        """
        author: [email protected]

        :param repetitions: no of opened tabs with desired media content from youtube.com
        :param video_name: name of desired media content from youtube.com
        :param google_query: desired google query to be executed in google graphics
        """

        driver = self.driver

        for repetition in range(1, repetitions, 1):

            driver.get("https://www.youtube.com/")
            elem = driver.find_element_by_name("search_query")
            elem.clear()
            elem.send_keys(video_name)
            elem = driver.find_element_by_id("search-icon-legacy")
            elem.click()
            elem = driver.find_element_by_xpath(
                '//*[@class="yt-simple-endpoint style-scope ytd-video-renderer"]'
            )
            elem.click()
            # open a new tab
            keyboard.SendKeys("^t")
            # commented line below is an alternative way to open a new tab
            # driver.execute_script('''window.open("http://google.pl","_blank");''')

            sleep(0.2)
            driver.switch_to.window(driver.window_handles[repetition])

        driver.get("https://www.google.com/imghp?/")
        elem = driver.find_element_by_name("q")
        elem.send_keys(google_query)
        elem.send_keys(Keys.RETURN)
Пример #9
0
 def accept_then_back(self):
     if locateOnScreen(self.material['game_ready'],
                       grayscale=True) or locateOnScreen(
                           self.material['accept'], grayscale=True):
         keyboard.SendKeys('{ENTER}')
         # sleep(self.TIME_SLOT)
         hotkey('alt', 'tab')
Пример #10
0
    def spectrum_save(self,
                      dir,
                      base,
                      startnum,
                      numfiles=1,
                      interval=0,
                      comment=None,
                      new_file_format=False):
        self.save_dir = dir
        self.basename = base
        self.nextnum = str(startnum)

        while len(self.nextnum) < INDEXNUMLEN:
            self.nextnum = '0' + self.nextnum
        save = self.app['Spectrum Save']
        if save.exists() == False:
            self.menu.open_control_dialog(
                [IMG_LOC + '/rs3specsave.png', IMG_LOC + '/rs3specsave2.png'])
        for _ in range(int(2.5 / self.interval)):
            save = self.app['Spectrum Save']
            if save.exists():
                break
            else:
                print('no spectrum save yet')
                time.sleep(self.interval)

        if save.exists() == False:
            print('ERROR: Failed to open save dialog')
            raise Exception
            return
        save.Edit6.set_edit_text(dir)
        save.Edit7.set_edit_text('')
        save.Edit5.set_edit_text(base)
        save.Edit4.set_edit_text(startnum)

        save.set_focus()
        okfound = False
        controls = [
            save.ThunderRT6PictureBoxDC3, save.ThunderRT6PictureBoxDC2,
            save.ThunderRT6PictureBox
        ]
        while True:
            for control in controls:
                control.draw_outline()
                rect = control.rectangle()
                loc = find_image(IMG_LOC + '/rs3ok.png', rect=rect)
                if loc != None:
                    control.click_input()
                    okfound = True
                    break
            if okfound:
                break
            print('searching for OK button')
            time.sleep(0.5)

        message = self.app['Message']
        if message.exists():
            self.app['Message'].set_focus()
            keyboard.SendKeys('{ENTER}')
def get_text():
    """ Copies the text from the wanted file (window_name)

		Args:
			None.
		Returns:
			The wanted text (str)
	"""
    content = pyperclip.paste()  #Gets clipboard's content before the action

    keyboard.SendKeys("^A")
    keyboard.SendKeys("^C")  #Copy everything
    text_to_file = pyperclip.paste()  #Clipboard's content to variable

    pyperclip.copy(content)  #Gets what it had before

    return text_to_file
Пример #12
0
    def process_form(self, test_data):
        # Form loading time is very dependent on PC performance. Based on tests loading takes from 5 to 30 sec
        formLoaded = False
        numberOfTries = 3
        self.app.window(
            title_re=".*Error Correction Station - .*", ).wait('visible')
        while not formLoaded and numberOfTries:
            app = self.app.window(title_re=".*Error Correction Station - .*", )
            if app.Keying.wait('visible', timeout=30):
                formLoaded = True
                break
            numberOfTries -= 1
            time.sleep(10)

        # ToDO: Rewrite hardcoded part
        # Another Medved's or Framework bug
        # memberTFN = random.choice(['862793498', '123456789'])
        # app.Keying.Edit2.set_text(memberTFN)

        # Supposing the very first field is 'MemberTFN'
        memberTFN = test_data[0]
        keyboard.SendKeys(memberTFN)

        numberOfFieldsToEdit = test_data[1]
        while numberOfFieldsToEdit:
            moveNFieldDown = test_data[2]
            keyboard.SendKeys(moveNFieldDown)

            # Setting 'Random value' text for any editable field and 'Checked' for checkboxes:
            currentFieldValue = test_data[3]
            if not app.Keying.Edit2.wrapper_object().get_value():
                keyboard.SendKeys(currentFieldValue)
            else:
                keyboard.SendKeys('{SPACE}')
            numberOfFieldsToEdit -= 1

        keyboard.SendKeys('^s')
        if app.window(title="Confirm Saving of keyed document").exists():
            app.OK.click()
            if app.window(title="Can't Save document with errors").exists():
                app.OK.click()
                return (0, 1)  # ECS required
            else:
                app.Save.click()
                return (0, 0)  # ECS doesn't required
Пример #13
0
    def start_vwEbooks_app(self):
        app = Application().Start(
            cmd_line=u'"C:\\Program Files\\VW-eBook-AC\\Bookshelf.exe" ')
        cefclient = app.CEFCLIENT
        cefclient.Wait('ready')

        time.sleep(2)
        keyboard.SendKeys("{ENTER}")
        self.currentWindow = cefclient
Пример #14
0
def datacreate():
    app = Application(backend="uia").start("OscGraph.exe")
    time.sleep(5)
    app.Window_(
        best_match='Многоканальный осциллограф',
        top_level_only=True).child_window(title="Запись",
                                          auto_id="1016",
                                          control_type="Button").click()
    keyboard.SendKeys("{ENTER}")
Пример #15
0
    def fix_errors(self, mode):
        self.app.window(
            title_re=".*Error Correction Station - .*", ).wait('visible')
        app = self.app.window(title_re=".*Error Correction Station - .*", )
        if not app.Pane22.OnlyErrorFields.get_toggle_state():
            app.Pane22.OnlyErrorFields.click()

        error_list = app.Pane22.child_window(auto_id="_lvRuleErrors",
                                             control_type="List").texts()
        if mode == 'KeyEntry':
            for _field, _error in error_list[1:]:
                # ToDO document errors stored here. some logic would be nice (etc Date, TFN, ABN format)
                # Do some checks
                if _error == 'Invalid date!':
                    keyboard.SendKeys('{ENTER 2}')
                keyboard.SendKeys('{ENTER}')
                app.Dialog.ContinueAnyway.click()
            app.Dialog.Save.click()
Пример #16
0
 def autoComplete_single(self, gui):
     try:
         # 一時記憶したユーザID/Mailとパスワードを取得
         Memorize = gui.cmdEvt.getMemorize()
         IDorMail = Memorize['user']
         passWord = Memorize['pass']
         # print('memorized data...ID:' + IDorMail + ' , PASS:' + passWord)
         # IDorMailが取得されているなら,片方を自動入力
         if IDorMail == "":
             return
         # 記号を打ち込めるように変換
         IDorMail_translated = self.transStringForPywinauto(IDorMail)
         passWord_translated = self.transStringForPywinauto(passWord)
         # 0:ID/Mail, 1:passWord
         if gui.cmdEvt.completeTarget == 0:
             pywinauto_keyboard.SendKeys(IDorMail_translated, pause=0)
         else:
             pywinauto_keyboard.SendKeys(passWord_translated, pause=0)
     except:
         traceback.print_exc()
Пример #17
0
 def new_form_barcode(self):
     # new form barcode
     app = self.app[self.station_name + 'Dialog']
     list_box = app.NewFormBarcodeDialog.GroupBox2.ListBox1
     barcodes_list = list_box.texts()
     # Todo: Improvement: choose form barcode randomly
     # list_box.ListItem0.select()
     keyboard.SendKeys('{DOWN}')
     app.NewFormBarcodeDialog.AddForm.click()
     print('{} ------ Form barcode {} was specified'.format(
         Helper.current_time(), barcodes_list[0]))
Пример #18
0
def run():
    zoom_window = open_zoom()

    activate_movie_window()

    time.sleep(1)
    SetForegroundWindow(zoom_window)
    mouse.click(coords=(150, 150))
    # 等待连接
    time.sleep(10)
    # 开始分享
    keyboard.SendKeys('%s')
    # 选择分享哪个程序
    time.sleep(1)
    keyboard.SendKeys('{TAB}')
    time.sleep(1)
    keyboard.SendKeys('{TAB}')
    time.sleep(1)
    keyboard.SendKeys('{DOWN}')
    time.sleep(1)
    keyboard.SendKeys('{RIGHT}')
    time.sleep(1)
    # 勾选共享电脑声音
    keyboard.SendKeys('{TAB}')
    time.sleep(1)
    keyboard.SendKeys('{SPACE}')
    # 确认分享
    time.sleep(1)
    share_window = find_window(title='选择一个您想共享的窗口或程序')
    SetForegroundWindow(share_window)
    time.sleep(1)
    keyboard.SendKeys('{TAB}')
    time.sleep(1)
    keyboard.SendKeys('{TAB}')
    time.sleep(1)
    # 定位到了“开始共享”按钮
    keyboard.SendKeys('{SPACE}')

    time.sleep(60 * 30)
    close_share_window(zoom_window)
    close_zoom(zoom_window)
Пример #19
0
 def open_files(self, path):
     print('Opening files from ' + path)
     self.spec.menu_select('File -> Open')
     open = wait_for_window(self.app, 'Select Input File(s)')
     open.set_focus()
     open['Address Band Root'].toolbar.button(0).click()
     #open['Address Band Root'].edit.set_edit_text(path)
     keyboard.SendKeys(path)
     open['Address Band Root'].edit.set_focus()
     keyboard.SendKeys('{ENTER}')
     print('opened files!')
     time.sleep(
         0.5)  #Of this and next two sleeps, not sure if 1 or all is needed.
     #Make sure *.0** files are visible instead of just *.asd. Note that this won't work if you have over 100 files!!
     open.ComboBox2.select(0).click()
     time.sleep(0.5)
     open.ComboBox2.select(0).click()
     time.sleep(0.5)
     open.directUIHWND.ShellView.set_focus()
     keyboard.SendKeys('^a')
     keyboard.SendKeys('{ENTER}')
Пример #20
0
def start_and_expect_integrity_error(exe):
  #starts the program instead of the webdriver because of expected system-error-message which webdriver can't handle
  #requires the clean_up keyword in robot to kill when the error-message doesn't appear, because no webdriver is instantiated.
  app = Application(backend="uia").start(exe)
  #get content of error message
  error = app.Error.Static2.window_text()

  print error
  #try to close the window
  keyboard.SendKeys('{ENTER}')

  #check if the integrity is used in error message, because it's not a caught exception in the application atm
  assert "Integrit" in error, "Not Integrity Error"
Пример #21
0
    def ascii_export(self, path, tsv_name):
        print('Doing ASCII export.')
        self.select_all()
        self.spec.menu_select('Process -> ASCII Export')
        export = self.app['ASCII Export']
        export.ReflectanceRadioButton.check()
        export.AbsoluteCheckBox.check()
        export.OutputToASingleFileCheckBox.check()
        export.set_focus()
        time.sleep(2)
        export.Button2.click_input()

        save = self.app['Select Ascii File']
        save.set_focus()
        save.ToolBar2.double_click()
        keyboard.SendKeys(path)
        keyboard.SendKeys('{ENTER}')
        save.edit.set_edit_text(tsv_name)
        save.set_focus()
        time.sleep(2)
        save.OKButton.click_input()
        time.sleep(5)
        try:
            self.app['Dialog'].OKButton.click()
        except:
            time.sleep(30)
            try:
                print('Retrying')
                self.app['Dialog'].OKButton.click()
            except:
                timeout = 800
                while 'Dialog' not in self.app and timeout > 0:
                    print('Still looking...')
                    time.sleep(10)
                    timeout -= 10
                self.app['Dialog'].OKButton.click()
Пример #22
0
    def load_extension(self):
        app = self.app[self.station_name + 'Dialog']

        # Choosing extension
        app.KeyEntryButton.click()

        # Getting available projects list
        list_box = app.KeyEntryprojectDialog.ListBox
        projects_list = list_box.texts()
        # Todo: Improvement: choose project randomly
        #list_box.ListItem0.select()

        keyboard.SendKeys('{UP}')
        app.KeyEntryprojectDialog.OK.click()

        print('{} Key Entry mode loaded, project: {} was chosen'.format(
            Helper.current_time(), projects_list[0]))
Пример #23
0
 def white_reference(self):
     self.spec.set_focus()
     keyboard.SendKeys('{F4}')
     start_timeout = 10
     t = 0
     started = False
     while not started and t < start_timeout:
         loc = find_image(
             IMG_LOC + '/status_color.png',
             rect=self.spec.ThunderRT6PictureBoxDC6.rectangle())
         if loc != None:
             started = True
         else:
             time.sleep(self.interval)
             t += self.interval
     if t >= start_timeout:
         print('wr failed')
         self.wr_failure = True
         return
     print('wr started')
     finish_timeout = 10 + int(self.numspectra) / 9
     t = 0
     finished = False
     while not finished and t < finish_timeout:
         loc = find_image(
             IMG_LOC + '/white_status.png',
             rect=self.spec.ThunderRT6PictureBoxDC6.rectangle())
         if loc != None:
             finished = True
         else:
             time.sleep(self.interval)
             t += self.interval
     if t >= finish_timeout:
         self.wr_failure = True
         print('wr failed')
         return
     time.sleep(
         2
     )  #This is important! Otherwise the spectrum won't be saved because the spacebar will get pushed before RS3 is ready for it.
     print('wr succeeded')
     self.wr_success = True
Пример #24
0
 def goToUserProfile(self):
     try:
         self.initialSetUp()
         keyboard.SendKeys('{VK_TAB 14}')
         keyboard.SendKeys('{ENTER}')
         self._clipboardUpdate('a.r')
         sleep(7)
         self._clipboardUpdate('a.r')
         keyboard.SendKeys(r'^v')
         keyboard.SendKeys('{ENTER}')
         sleep(1)
         self._clipboardUpdate('4')
         keyboard.SendKeys(r'^v')
         keyboard.SendKeys('{ENTER}')
     except Exception:
         pass
def find_tab(app, name):
    """ Switches tabs until it finds the good one
		
		Args:
			app: The application's object.
			name: Name of the tab to be found.
		Returns:
			Bool
	"""

    current_window = ""
    starting_window = str(app.windows()[0]).split("'")[1]

    #Passes on every tabs until it finds it /or/ gets back to the starts
    while current_window != starting_window:
        keyboard.SendKeys('^{PGDN}')  #Changing tab
        current_window = str(
            app.windows()[0]).split("'")[1].lower()  #Get window's name

        if current_window.find(name.lower()) > -1:
            return True

    return False
Пример #26
0
    def windows():
        """
		Automate Windows
		"""
        time.sleep(2)
        app = Application().start('explorer.exe')
        time.sleep(2)
        w_handle = pywinauto.findwindows.find_windows(
            title=u'File Explorer', class_name='CabinetWClass')[0]
        window = app.window(handle=w_handle)
        window.set_focus()
        ctrl = window['9']
        ctrl.set_focus()
        ctrl = window['9']
        ctrl.click_input()
        keyboard.SendKeys(os.getcwd() + "{ENTER} {SPACE} {DOWN} {DOWN}")
        if pyautogui.locateOnScreen(os.getcwd() +
                                    '\\Screenshots\\folder\\IT395folder2.PNG',
                                    confidence=.6) is not None:
            pyautogui.moveTo(
                pyautogui.locateCenterOnScreen(
                    os.getcwd() + '\\Screenshots\\folder\\IT395folder2.PNG',
                    confidence=.6))
            if pyautogui.locateOnScreen(
                    os.getcwd() + '\\Screenshots\\website\\DROParea7.PNG',
                    confidence=.6) is not None:
                pyautogui.dragTo(pyautogui.locateCenterOnScreen(
                    os.getcwd() + '\\Screenshots\\website\\DROParea7.PNG',
                    confidence=.6),
                                 duration=3.0,
                                 button='left')
            else:
                print("Could not locate drop area! Exiting...")
                sys.exit()
        else:
            print("Could not locate folder! Exiting...")
            sys.exit()
Пример #27
0
 def login(self):
     try:
         if (self.ui.lineEdit.text()=='' or self.ui.lineEdit_2.text()==''):
             pass
         else:
             self.initialSetUp()
             keyboard.SendKeys('{VK_TAB}')
             self._clipboardUpdate(self.ui.lineEdit.text())
             keyboard.SendKeys(r'^v') 
             keyboard.SendKeys('{VK_TAB}')
             self._clipboardUpdate(self.ui.lineEdit_2.text())
             keyboard.SendKeys(r'^v')
             sleep(1)
             keyboard.SendKeys('{ENTER}')
             sleep(5)
             keyboard.SendKeys('{ENTER}')
     except Exception:
         pass
Пример #28
0
    def checkbuyprices(self):
        try:
            print("Go to check GoatBots prices...")
            self.bot_to_buy = "GoatBots3"
            try:
                click_trade(self.app)
                self.app.top_window().window(auto_id="searchTextBox").type_keys(self.bot_to_buy + "{ENTER}")
            except:
                return

            if not self.click_bot_trade(self.bot_to_buy, "ABinder"):
                print("Bot is offline")
                self.is_trade_cancelled()

            while self.is_trade_cancelled() or self.is_trade_stalled():
                self.switch_goatbot()
                self.click_bot_trade(self.bot_to_buy, "ABinder")
                time.sleep(3)

            click_rectangle(self.app.top_window().window(title="Search Tools", found_index=0).rectangle())
            click_rectangle(self.app.top_window().window(title="Import Deck", found_index=0).rectangle())
            time.sleep(3)
            keyboard.SendKeys("hotlist" + str(self.round) + ".dek" + "{ENTER}")
            #self.app.top_window().window(title="File name:", found_index = 1).type_keys("hotlist" + str(self.round) + ".dek" + "{ENTER}")
            try:
                click_rectangle(self.app.top_window().window(auto_id="TitleBarCloseButton", found_index=0).rectangle())
            except:
                pass

            time.sleep(16)
            self.get_prices(self.bot_to_buy)
            click_rectangle(self.app.top_window().window(title="Cancel Trade", found_index=1).rectangle())
            time.sleep(3)
            close_chat(self.app)
        except:
            pass
Пример #29
0
def ths_close():
    ths_restore()
    time.sleep(2)
    keyboard.SendKeys('%{F4}')
Пример #30
0
from pywinauto.application import Application
from pywinauto import keyboard, mouse
import time


app = Application().start("C:/Users/Tarek/Desktop/BN cephalo/NNTViewer.exe")
time.sleep(1)
keyboard.SendKeys('{DOWN}')
time.sleep(0.3)
keyboard.SendKeys('{ENTER}')
time.sleep(1.5)
mouse.click(button='left', coords=(100, 400))
time.sleep(0.3)
app.window_(title_re = "iRYS*").MenuSelect("Dossier->Enregistrer l'image sous")
mouse.click(button='left', coords=(300, 400))
time.sleep(0.5)
keyboard.SendKeys('%t')
time.sleep(0.3)
keyboard.SendKeys('{DOWN}')
time.sleep(0.3)
keyboard.SendKeys('{DOWN}')
time.sleep(0.3)
keyboard.SendKeys('{ENTER}')
time.sleep(0.3)
keyboard.SendKeys('{ENTER}')
time.sleep(1.5)
keyboard.SendKeys('%{F4}')