Back to Browse

how to run your python script in the background with no user interactive every time windows starts.

9.0K views
Dec 15, 2022
5:24

#python #automation #windows #programming #trending #viral import time import ctypes ApplicationToClose = "Google Chrome" # give here the application name while True: window = ctypes.c_char_p(bytes()) ActiveWindowHandle = ctypes.windll.user32.GetForegroundWindow() ctypes.windll.user32.GetWindowTextA(ActiveWindowHandle,window,250) if ApplicationToClose in str(window.value, "cp1252"): print(str(window.value, "cp1252")) ctypes.windll.user32.PostMessageA(ActiveWindowHandle, 16, 0, 0) print("%s closed"%(ApplicationToClose)) time.sleep(0.1)

Download

0 formats

No download links available.

how to run your python script in the background with no user interactive every time windows starts. | NatokHD