Jump to content

Recommended Posts

  • Moderators
Posted (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 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!

Posted

@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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...