本文整理汇总了Python中pyautogui.hotkey函数的典型用法代码示例。如果您正苦于以下问题:Python hotkey函数的具体用法?Python hotkey怎么用?Python hotkey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hotkey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_command
def send_command(self, cmd):
self.save_screenshot()
pyautogui.hotkey('ctrl', 'space')
pyautogui.typewrite(cmd)
self.save_screenshot()
pyautogui.press('enter')
pyautogui.press('escape')
示例2: printscores
def printscores():
#note only works in Firefox
#selects all of the scores
try:
selectall = WebDriverWait(browser, 3).until(EC.presence_of_element_located((By.ID, "m_m_mid_mid_ReportByDate2_rptDataView_ctl00_ctl02_ctl01_GridClientSelectColumnSelectCheckBox")))
selectall.click()
except:
pass
#exports to pdf
export = WebDriverWait(browser, 2).until(EC.presence_of_element_located((By.ID, "m_m_top_wel_imgBtnExport")))
export.click()
logging.debug("Still working")
#chooses pdf from the popup
browser.switch_to.frame('rwPreview')
choosepdf = WebDriverWait(browser, 2).until(EC.presence_of_element_located((By.ID, "radio4")))
choosepdf.click()
donebutton = browser.find_element_by_id('imgBtnDone')
donebutton.click()
#todo let it continue when the pdf downloads and break if it does not download
time.sleep(5)
pyautogui.press('enter')
time.sleep(2)
pyautogui.hotkey('ctrl', 'j')
time.sleep(2)
pyautogui.press('enter')
time.sleep(4)
pyautogui.hotkey('ctrl', 'p')
time.sleep(4)
pyautogui.press('enter')
time.sleep(4)
pyautogui.typewrite(printcode)
pyautogui.press('enter')
示例3: episode_get_mcn_and_ref
def episode_get_mcn_and_ref():
# get mcn
mcn = pyperclip.copy('na')
pya.moveTo(424, 474, duration=0.1)
pya.dragTo(346, 474, duration=0.1)
pya.hotkey('ctrl', 'c')
mcn = pyperclip.paste()
pya.moveTo(424, 474, duration=0.1)
pya.click(button='right')
pya.moveTo(481, 268, duration=0.1)
pya.click()
mcn = pyperclip.paste()
mcn = mcn.replace(' ', '')
# get ref
ref = pyperclip.copy('na')
pya.moveTo(500, 475, duration=0.1)
pya.dragRel(-8, 0, duration=0.1)
pya.hotkey('ctrl', 'c')
ref = pyperclip.paste()
pya.moveRel(8, 0, duration=0.1)
pya.click(button='right')
pya.moveTo(577, 274, duration=0.1)
pya.click()
ref = pyperclip.paste()
return mcn, ref
示例4: FillinExcelxCV1
def FillinExcelxCV1():
# Close current edit area
xCloseN=(399,200)
pyautogui.moveTo(xCloseN)
time.sleep(0.25)
pyautogui.click()
time.sleep(0.1)
# Back to Excel
xExcel=(337,746)
xExcelDown=(1356,670)
xCellEditC=(267,238)
pyautogui.moveTo(xExcel)
time.sleep(0.25)
pyautogui.click()
time.sleep(0.5)
# Move and Paste in C
pyautogui.moveTo(xCellEditC)
time.sleep(0.25)
pyautogui.click()
time.sleep(0.1)
pyautogui.hotkey('ctrl','v')
time.sleep(0.1)
pyautogui.hotkey('ctrl','s') #Save Excel
time.sleep(1.5)
pyautogui.moveTo(xExcelDown)
time.sleep(0.25)
pyautogui.click()
time.sleep(0.5)
示例5: cut
def cut(link, FolderName):
global UserName
global Password
global WaitTime
global ChromiumBinary
global UserNameLocation
global PasswordLocation
global PrepdButtonLocation
global FolderSelectLocation
global CatchButtonLocation
global FirstBool
print "Link: " + link
print "Folder Name: " + FolderName + "\n"
Popen([ChromiumBinary, "--incognito", link])
print "went to rss link"
time.sleep(WaitTime)
pyautogui.moveTo(PrepdButtonLocation[0], PrepdButtonLocation[1])
pyautogui.click()
print "clicked on prepd button"
time.sleep(WaitTime)
if FirstBool == True:
#login
time.sleep(WaitTime)
pyautogui.moveTo(PasswordLocation[0], PasswordLocation[1])
pyautogui.click()
pyautogui.typewrite(Password, interval=0.05)
print "typed password"
pyautogui.moveTo(UserNameLocation[0], UserNameLocation[1])
pyautogui.click()
pyautogui.typewrite(UserName, interval=0.05)
print "typed username"
pyautogui.press('enter')
print "logged in"
time.sleep(WaitTime)
pyautogui.moveTo(FolderSelectLocation[0], FolderSelectLocation[1])
pyautogui.click()
print "clicked on folder selection"
pyautogui.typewrite(FolderName, interval=0.05)
pyautogui.press('enter')
print "typed into folder selection"
pyautogui.moveTo(CatchButtonLocation[0], CatchButtonLocation[1])
pyautogui.click()
time.sleep(WaitTime)
print "caught article"
pyautogui.press("esc")
pyautogui.hotkey('ctrl', 'w')
print "closed tab\n"
示例6: quoteOSHPark
def quoteOSHPark(self):
"""Function for navigating OSHPark's website."""
url, user, pw = self.readConfig('oshpark', 'rigid')
# Open new tab and go to URL
self.newTab()
self.driver.get(url)
# Enter login information
self.driver.find_element_by_css_selector('#user_email').send_keys(user)
self.driver.find_element_by_css_selector('#user_password').send_keys(pw)
# Click login button
self.driver.find_element_by_css_selector('.buttons > input:nth-child(1)').click()
self.driver.find_element_by_css_selector('#ember291').click()
self.driver.find_element_by_css_selector('#file_selector > input:nth-child(2)').click()
e = EWMH()
windows = e.getClientList()
for window in windows:
if e.getWmName(window) == 'File Upload':
time.sleep(0.5)
e.setActiveWindow(window)
e.display.flush()
time.sleep(0.5)
pyautogui.hotkey('ctrl', 'a')
pyautogui.press('backspace')
# '''get file location from config file'''
# pyautogui.typewrite(fileLocation)
pyautogui.press('return')
示例7: episode_gp
def episode_gp():
pya.hotkey('alt', 'a')
pya.typewrite(['tab'] * 4, interval=0.1)
gp = pyperclip.copy('empty')
pya.hotkey('ctrl', 'c')
gp = pyperclip.paste()
return gp
示例8: switchTabWindow
def switchTabWindow(self, direction):
#left = 0, right = 1
if direction == 0:
pag.hotkey('command', 'shift', '[')
elif direction == 1:
pag.hotkey('command', 'shift', ']')
else:
assert direction == 0 or direction == 1, "Actor::switchWindow: wrong direction"
示例9: perform_action
def perform_action(self, clazz):
if clazz == 'flip':
pyautogui.hotkey('command', 'space')
elif clazz == 'top_down':
pyautogui.press('space')
elif clazz == 'right_left':
pyautogui.press('right')
print "dummy"
示例10: loadSymbolInChart
def loadSymbolInChart(msComponents, symbol):
pyautogui.moveTo(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'], 0.25)
safeClick(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'])
pyautogui.hotkey(platform.primary_key_modifier, 'a')
pyautogui.press('delete')
pyautogui.typewrite(symbol)
pyautogui.typewrite(['enter'])
wait(DELAY_CHART_LOAD)
示例11: OnKeyboardEvent
def OnKeyboardEvent(event):
if chr(event.Ascii) == 'i' and event.IsAlt():
pyautogui.keyDown('alt')
pyautogui.keyDown('shift')
pyautogui.keyUp('shift')
pyautogui.keyUp('alt')
pyautogui.hotkey('ctrl', 'i')
return False
return True
示例12: switchDesktop
def switchDesktop(self, direction):
#left = 0, right = 1
if direction == 0:
pag.hotkey('ctrl', 'left')
elif direction == 1:
pag.hotkey('ctrl', 'right')
else:
assert direction == 0 or direction == 1, "Actor::switchDesktop: wrong direction"
示例13: get_title
def get_title():
pya.hotkey('alt', 't')
title = pyperclip.copy('na')
pya.moveTo(190, 135, duration=0.1)
pya.click(button='right')
pya.moveRel(55, 65)
pya.click()
title = pyperclip.paste()
return title
示例14: pass_search
def pass_search():
pyautogui.PAUSE = 0.5
pyautogui.FAILSAFE = False
pyperclip.copy("")
dondeEstaElBoton = pyautogui.locateOnScreen("go-button.png")
if dondeEstaElBoton is None:
print "El boton de GO no fue encontrado"
else:
botonPos = list(dondeEstaElBoton)
print botonPos
centroBoton = pyautogui.center(botonPos)
print centroBoton
contador = 0
while True:
contador += 1
pyautogui.moveTo(centroBoton)
pyautogui.moveRel(796, 0) # Mover el raton a la barra de desplazamiento
pyautogui.click(None, None, 2)
# if contador == 1:
# time.sleep(0.3)
# pyautogui.typewrite('!reset')
# pyautogui.press('enter')
pyautogui.click(None, None, 1)
pyautogui.dragRel(0, -293, 1, button="left")
# pyautogui.scroll(10) #Hacer scroll para llegar a la parte superior del cuadro de texto
# pyautogui.moveRel(0, -294) #Mover el raton a la parte superior de la barra de desplazamiento
pyautogui.moveRel(-390, 0) # Mover el raton a la posicion en donde se encuentra la clave
pyautogui.PAUSE = 0.05
pyautogui.click(None, None, 2)
# pyautogui.doubleClick() #Hacer dobleclic en la palabra de la clave
pyautogui.hotkey("ctrl", "c")
# pyautogui.doubleClick() #Hacer dobleclic en la palabra de la clave
# pyautogui.hotkey('ctrl', 'c')
# pyautogui.doubleClick() #Hacer dobleclic en la palabra de la clave
# pyautogui.hotkey('ctrl', 'c')
pyautogui.PAUSE = 1
r = pyperclip.paste()
print r
if len(r) == 10:
print "clave encontrada"
break
if contador == 5:
print "Se hizo el intento 5 veces para buscar la clave"
break
time.sleep(0.5)
示例15: typeAndSave
def typeAndSave(self, msg):
"""
A matching keystroke is sent for each character in msg.
Afterwards, ctrl+s is sent.
"""
keys = list(msg) + ["enter"]
pyautogui.typewrite(keys, interval=0.05)
pyautogui.hotkey("ctrl", "s")
time.sleep(1)