2

Here's my script:

import pyautogui
import subprocess
import time

#notepad is in the file path
programma = "Notepad"

#opening notepad
subprocess.Popen(programma)

#gives time to open notepad, ie I've also tried with higher numbers
time.sleep(1)

pyautogui.keyDown('NumLock')
#I've also tried with 
pyautogui.hotkey('alt', 'num3')

I've tried and the Numpad works: if I comment the take out 'alt' and just write pyautogui.press('num3') it types the number 3. Although if I put alt in the code, it gives an error, as if I were typing without having the cursor set. I've also tried

pyautogui.keyDown('alt')
pyautogui.keyDown('num3')
pyautogui.keyUp('num3')
pyautogui.keyUp('alt')

Does anyone know what to do? Thanks in advance

javier__
  • 22
  • 6
Dave
  • 21
  • 2

1 Answers1

1

Working for me:

pyautogui.keyDown('alt')
pyautogui.press("num3")
pyautogui.keyUp('alt')

If you try to .keyDown('num3') pyautogui will think you want to use a third key in your combination.

VRumay
  • 113
  • 8