MobilAdmin 0 Posted December 7, 2010 I have a program running that needs to be close properly every night so that a database can be maintained and backed up. The problem I'm having is that windows thinks that the window is active, then sends the command to shut it down but the window is not fully active. The script will bring the window to the front, but it is not highlighted. The command is sent to shut it down, but it does not. I don't want to just close the window because it might corrupt the database. Any help would be greatly appreciated.automate.txt Share this post Link to post Share on other sites
Varian 8 Posted December 7, 2010 Have you tried ControlSend?ControlSend("Automate", "", "", "{ALTDOWN}x{ALTUP}") Share this post Link to post Share on other sites
MobilAdmin 0 Posted December 7, 2010 ControlSend works just as good as the Send command. My problem is when I do a WinActivate, the window gets focus but is not fully active. The window is brought to the front, but is not highlighted. I tried looping WinActivate with WinActive to make sure the window gets full focus, but it doesn't work. What am I missing? Share this post Link to post Share on other sites
Varian 8 Posted December 7, 2010 My understanding of your problem is that you are trying to close a program window. Assuming that Control-X will close the window, I suggested that you use ControlSend so the window does not need to be active.Can you activate it with the Alt-Tab method? If so there is a that may give you a chance.Just out of curiosity, have you experimented with WinSetonTop?Does hitting Alt-X close the windowor both the window and the program? Share this post Link to post Share on other sites
MobilAdmin 0 Posted December 7, 2010 Thanks for the response. I was over thinking it way to much. I was using more commands than I needed to use. Instead of using WinActivate, WinActive, and WinExists to do what I wanted, I should have just used ControlSend. It works just fine everytime. Thanks again. Share this post Link to post Share on other sites