I use the win32gui library to get the Windows Security popup handle and use win32con to click the Install button inside, but to no avail. Has anyone done this before successfully in Python?
I know that I can always install a publisher certificate and be prepared for it, but I need to consider all the security warnings that may appear.
This can be done because I successfully executed this in VBScript, but now I need Python.
.
def window_handle(Title): handle = win32gui.FindWindowEx(0, 0, 0, Title) return handle def click_btn(hWnd, Button): hbutton = win32gui.FindWindowEx(hWnd, 0, "Button", Button) if hbutton != 0: win32api.PostMessage(hbutton, win32con.WM_LBUTTONDOWN, 0, 0) win32api.PostMessage(hbutton, win32con.WM_LBUTTONUP, 0, 0) return True return None hWnd = window_handle("Windows Security") click_btn(hWnd, "&Install")
source share