I'm trying to get text from the screen automatically using pyautogui, with this code:
pyautogui.keyDown('shift')
time.sleep(0.1)
pyautogui.press('esc')
pyautogui.press(['down','down','down','down'])
pyautogui.keyUp('shift')
pyautogui.hotkey('ctrl','c')
but the command keyDown('shift')
doesn't work. Could someone help me with this error?
Pyautogui should let you use the hotkeys here, and you could probably tidy things up with a loop:
for i in range(0, times_to_run):
pyautogui.hotkey('shift', 'down')
Then you don't have to worry about using keyUp
or time.sleep()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.