I am supporting a legacy Paradox 4.5 for DOS system. Our users connect to a single terminal server (Windows Server 2003) to run Paradox. We frequently need to boot everyone out of the system. Our Paradox Admin will attach to each remote desktop session, log the user out of Paradox and logout of Windows.
I would like to automate this process.
Closing the DOS window without shutting down paradox can lead to data corruption. If I can send keystrokes to the app, I can shut it down gracefully.
1) How can I send keystrokes to an existing DOS window from Windows? I have seen vbscript examples and sendkeys but these seem to be used to control windows when the window's handle is available. I need to control a window that is already open.
2) Is it possible to automatically execute the keystroke send when remote desktop idle logoff is executed?
Haven't tested this (yet), but here is an idea.
1) It appears possible to use either of the SendKeys functions to pass keystrokes to the window currently in focus through Powershell.
To bring a chosen window in focus this post seems to provide the Powershell snippet, as long as you somehow can identify the Paradox window process. If you can't do that I cannot imagine how this would be automatable anyhow, unless you can find some workaround specific to how Paradox operates.
2) It should be possible to attach a task to the relevant event id which fires your script. As long as the script processes before explorer and all of its child windows exit (you would have to test for this) I guess it could work.