Answer the question
In order to leave comments, you need to log in
Why am I getting the pywinauto.application.AppNotConnected error?
The code:
import pywinauto
from pywinauto import win32functions,win32defines
import time
import win32clipboard
import win32gui
import win32com.client
import subprocess
time.sleep(2)
ms=win32functions.SendMessage
shell = win32com.client.Dispatch("WScript.Shell")
pwa_app = pywinauto.application.Application()
try:
w = pywinauto.findwindows.find_windows(class_name='CabinetWClass')[0]
except:
w = pywinauto.findwindows.find_windows(class_name='Progman')[0]
window = pwa_app.window(handle=w)
C:\Users\ALEX\Desktop>python teee.py
Traceback (most recent call last):
File "teee.py", line 19, in <module>
window = pwa_app.window(handle=w)
File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\application.py", line 1226, in window
raise AppNotConnected("Please use start or connect before trying "
pywinauto.application.AppNotConnected: Please use start or connect before trying anything else
Answer the question
In order to leave comments, you need to log in
After the imports, do Application.Start
eitherApplication.Connect
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question