So I am having issues with getWindowsWithTitle function from pygetwindow. When I ask for input before the getWindowsWithTitle call, I get the following error:
Traceback (most recent call last):
File "*****\main.py", line 79, in <module>
handle.activate()
File "*****\venv\lib\site-packages\pygetwindow\_pygetwindow_win.py", line 246, in activate
_raiseWithLastError()
File "*****\venv\lib\site-packages\pygetwindow\_pygetwindow_win.py", line 99, in _raiseWithLastError
raise PyGetWindowException('Error code from Windows: %s - %s' % (errorCode, _formatMessage(errorCode)))
pygetwindow.PyGetWindowException: Error code from Windows: 0 - The operation completed successfully.
If I comment out my Input call, the getWindowsWithTitle works just fine. The following is my code so far
import win32gui
import time
from pynput.keyboard import Key, Controller
import pygetwindow as window
target = input("** Instance Name Is The Title When You Hover Over The Application ** \nSelect Instance Name: ")
handle = window.getWindowsWithTitle('Command')[0]
keyboard = Controller()
handle.activate()
handle.maximize()
time.sleep(2)
keyboard.press('a')
keyboard.release('a')
I am trying to get input to choose which window to select, but even putting "target" in the getWindowsWithTitle it gives me the same error. Does anyone know why I am getting this error after putting in my input?