IAMK Posted October 17, 2017 Share Posted October 17, 2017 Hello, My script needs to use the RunWait() function for external executables. However, I cannot find any information on killing the process. I have tried the equivalent of what is used to kill a process which was created using Run(), but it did not work, along with a few other things. E.g. https://www.autoitscript.com/autoit3/docs/functions/ProcessClose.htm Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 18, 2017 Moderators Share Posted October 18, 2017 (edited) @IAMK it should be pretty easy to see why - you are telling your script to...wait while the process runs. So if you have a line after that that kills the process, your script is still waiting at the previous line (like a good dog, waiting where you told it to). The easiest way to accomplish what you're after would be to simply use Run instead of RunWait, and then watch the process. Something like this: Run("notepad.exe") While ProcessExists("Notepad.exe") Sleep(100) If ProcessExists("iexplore.exe") Then ProcessClose("notepad.exe") WEnd Then, if your condition is true (another process, time running out, etc.) it closes the first. Or more simply: Run("notepad.exe") While Not (ProcessExists("iexplore.exe")) Sleep(100) WEnd ProcessClose("notepad.exe") Edited October 18, 2017 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
IAMK Posted October 18, 2017 Author Share Posted October 18, 2017 @JLogan3o13 Okay, that's a good solution. I will try that. As for the script waiting, that is not the issue. I have a hotkey which ends my script. I am able to end the script during the RunWait(), but if I also try to kill the process which I RunWait()ed, I'm unable to. Logically, Killing the process of a RunWait() should cause the RunWait() to finish, correct? 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