Код:
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