11

I am using pyautogui to simulate pressing shift and end at the same time - when I type this myself, it highlights all the entries, however when I do it via the code below, it just moves to the end file - not highlighting every component, so it seems like shift isn't being pressed. Was wondering if anyone had any ideas?

pyautogui.keyDown('shift')
pyautogui.keyDown('end')
pyautogui.keyUp('end')
pyautogui.keyUp('shift')
m_callens
  • 6,100
  • 8
  • 32
  • 54
timr
  • 111
  • 1
  • 1
  • 3
  • 1
    Did you tried the hotkey function? It does the same rather than writing four lines just write pyautogui.hotkey('shif','end') presses the keys in linear order and releases them in reverse. – Mehroz Irshad Mar 15 '17 at 10:47

1 Answers1

17

I know this question is old, but you can get the same result by doing:

pyautogui.hotkey('shift', 'end')
callium
  • 171
  • 1
  • 4