poo706 Posted April 7, 2008 Share Posted April 7, 2008 I've noticed with versions of Word and Excel (verified with 2000 and 2003) that sometimes after you shut down Word or Excel, it will continue running in the background. Sometimes with Word especially, it'll consume 100% of the CPU and drag the system to a halt. Hitting Ctrl-Alt-Del and ending the process fixes the problem. So I was trying to write a script that would run Word and wait until it's been closed by the user. Then I want it check to make sure there are no Word windows open (in case I have multiple .doc's open), and end the script if any Word window is open. If no Word window is open, I want it to check and see if there are any winword.exe processes running in the background, and then end the process if true. Problem is, I can't seem to get AutoIt3 to be able to tell the difference between an open window and a running process. I have experimented with WinGetState, WinActive, WinExists, and a few others, but they all seem to recognize the background process as an open window. Anyone have any experience with situations like this? [poo] Link to comment Share on other sites More sharing options...
Paulie Posted April 7, 2008 Share Posted April 7, 2008 Something like this? Opt('WintitleMatchMode',2) ;match any string in the title While 1 Sleep(100) If Not WinExists("- Microsoft Word") And ProcessExists("winword.exe") then ProcessClose("winword.exe") WEnd Link to comment Share on other sites More sharing options...
poo706 Posted April 8, 2008 Author Share Posted April 8, 2008 That's a bit fancier than the things I was trying, but more or less the same, just split up in different steps. I will give that a try. Problem is, to truly test this out I need Word or Excel to screw up and stay running, which doesn't happen all the time, and I can't seem to figure out what causes it to begin with. I saw it happen on a friend's computer too, so it's not just mine. Thanks for the help! [poo] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now