Question Locked

Power interruption will pause running DOS program

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a DOS program on a W98SE PC that will pause when the space bar is pressed. When there is a power interruption, I need to call a program from my APC UPS that will send Character 32 (the space bar) to the DOS program to pause it during the power loss.
APC don't offer any suggestions, so I am hoping someone else can help?

9 replies

by invicta1100

We have a PC running a CNC Mill. It accepts input from the cursor keys, and several others including the Space which Pauses the operation of the Mill. Without the UPS, when a power interruption occurs, it is necessary to restart the milling operations which is time consuming.
If we can get the UPS to Pause the mill until we can either restore power or shut it down gracefully, it would save considerable time, and aggravation.

by rob miners

you will have to link it so that when the UPS kicks in it will send the keystroke. I haven't played with this yet and I do not have a UPS to test with. Bummer

by invicta1100

When I contacted APC tech support, they said I only needed a small batch file, which they couldn't supply. In the configuration of their Powerchute software, it is simply a matter of entering the name of the batch file in their "command" box.

by rob miners

if it was just that simple. I'm not a coder and I have only been playing with scripts. I have never actually used sendkeys before. Anyway I have managed to work out how to sendkeys to word but to send to DOS is a bit trickier. Apparently I will have to work out how to get it to the clipboard to be able to paste it into DOS. If you can bare with me as I try to learn this we might be able to get it working.

Somebody out there has probably already achieved this but have not noticed your post.

by rob miners

This will have to be tested with Win98. "Name of DOS Program" is the name of the active window when the dos program is open. You may have to adjust the sleep times to make them longer.

Script
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 1000
' get focus of the active window
WshShell.AppActivate "Name of DOS Program"
WScript.Sleep 1000
WshShell.SendKeys "% (32)"
---------------------------------------------
Batch File

cscript //nologo c:\script.vbs

by invicta1100

Well..after a few days of trying to communicate with APC tech support, they finally advised that my Backups 400 will not do what they claimed when I bought it. Since it was purchased several years ago as only a standby power source, I wanted to try to expand its duties by connecting a serial cable to control the PC it was supporting.
APC now claim that the 400 model will only provide backup power and send info to a log file.
Although the preferences section has an option to have it run a batch file when it switched to battery power, they now say that is not possible.
Guess I'll have to check out another brand.

This discussion is closed to new replies.