One Python Script One GUI application
Python Script does two things, currently launches at boot up of windows 10 OS, via the Common Startup folder. Python Script is running as server software to communicate status and simple commands back and forth between an an Arduino board and client desktop. The second task is to monitor the GUI application. Recognizes if the GUI crashes, logs the crash, and then relaunches the application.
GUI Application also has two mode's. The first mode is manual mode. A user, who chooses to remote into the board, can operate an externally connected device/sensor. Giving the user full control. Mode two is an automation mode. This mode is enabled by default, and will implement routines to control the externally connected device/sensor. The GUI has a disable button to disable the automation mode, and enter the manual mode. The GUI was written in C++ with visual studio, using MFC for the GUI.
That's the background.
What I'm looking for is information on how to launch both the python script and the GUI Application on a headless system, so that when/if a user remotes into the desktop, they can interact with the GUI.
What I've done.
The first thing I tried was to load the python script into the startup folder. However, this folder only operates when a user logs on. So I did some more digging and found task scheduler. Running task scheduler sort of worked. It launched the python script just fine, and the python script launched the GUI application, but it was launched as a background process. So I couldn't interact with the GUI. The latest thing I've attempted was to move the python script into the Common Startup folder. This folder differs with the Startup folder by launching any application contained within at boot up, not when a user logs in. While, the python script launched just fine, the GUI only launches after a user logs in, so you will need to remote in to launch the GUI.
This system will be running for hours on end, without anyone logged in or paying attention to it. So the python script will need to be able to launch the GUI application, so that when/if someone logs into it they can make adjustments via the manual mode.
The python script launches the GUI application via a separate thread
overWatch = threading.Thread(target=cmd.overWatch, daemon=True)
def overWatch():
global relaunch
while True:
if relaunch == True:
if not checkIfProcessRunning(AIRIS):
print("Attempt to launch")
subprocess.call(['C:\\**\\***\\****\\*****.exe'])
Anyone have any insight?