I am using PyAutoGUI to try to code a macro. For this macro, I need to press a key to select something. To interact with the screen, I am using PyAutoGUI. Any ideas on how to press the key?
I have tried using this command.
pyautogui.press("s")
I'm not sure if anyone has helped out here or if you got this resolved in the end.
First, the documentation can be found here: https://pyautogui.readthedocs.io/en/latest/quickstart.html#keyboard-functions#
When passing a keystroke, you want to use "typewrite" and not "press"
Press "S"
pyautogui.typewrite("s")
Press Hotkey (Ctrl + S)
pyautogui.hotkey("ctrl" + "s")
Press key as a variable
pyautogui.keydown(variable)