Search code examples
pythonpython-3.xpyautogui

Unable to select text using pyautogui


I want to select some text on the screen. I figured using pyautogui would be the way to go. I did the following:

keyDown('shift')
sleep(0.1)
press('end')
sleep(0.1)
keyUp('shift')

When doing this exact combination by hand it does select the text I want it to. Of course the sleep function is from the time module.

I even tried to select text in word using the following:

keyDown('shift')
press('right')
press('right')
keyUp('shift')

And even this didn't work... Does anyone know why?

Thanks in advance!


Solution

  • I found the answer!
    It wasn't selecting text for me as long as num lock was enabled.

    Make sure num lock is disabled when using pyautogui