Python - Press key after certain program runs

1

So I have this program that has to be running 24/7, and whenever it crashes, this window pops up

Window I have to press "ok/enter" on

And all I wanted to schedule is an enter keypress whenever either this program runs or this window pops up.

I've tried creating an event with the log being an application but I can't choose which application it is, anyone know a solution?

EDIT: So I found a really simple solution for my problem using a python script, here it is if anyone is interested!

import pyautogui
import win32gui

while True:
    if win32gui.FindWindow(None, "Blacklist"):
        handle = win32gui.FindWindow(0, "Blacklist")
        win32gui.SetForegroundWindow(handle)
        pyautogui.typewrite(['enter', 'enter'])

Miranda Code

Posted 2018-09-06T11:06:25.857

Reputation: 11

Task Scheduler can't do this. But there is software that can do this. I use something myself that costs money but it can do it. I'm sure there are also freeware programs to automatically dismiss a popup window (which this basically is) – LPChip – 2018-09-06T11:12:07.433

Can you tell me the name of said software you use? – Miranda Code – 2018-09-06T11:12:49.133

Start the application as a service. Standard service management system can restart service if it crashes or hangs without any popup. – Akina – 2018-09-06T11:25:36.010

How do I start the application as a service? – Miranda Code – 2018-09-06T11:31:37.343

I use Actual Tools Window Manager, which is their total package. All features also have their own cheaper app. – LPChip – 2018-09-06T11:40:44.907

RunAsService project – Akina – 2018-09-06T12:00:49.467

You should post your findings as an answer so you can mark it solved in 2 days. That way, others know you no longer need help. – LPChip – 2018-09-06T19:52:43.523

No answers