Forum Discussion

puyopuy's avatar
puyopuy
Contributor
14 years ago

Is there a function to wait for process unit it finished

Hi there,



Just want to know is there a function to wait for a process until it finished.  I would like to close a process and wait until it gone and do something else.  Delay and waitProcess(xxx).Exists doesn't work for me.



Thanks

Puyo

3 Replies

  • Puyo,


    Could you please clarify why Exists does not work for you?


    >> Just want to know is there a function to wait for a process until it finished.

    One possible way is to close the process with the process.Close(...) method and pass the needed timeout to it.


    Another way is to use the WaitProperty method --




      Set p = Sys.Process("MyApp")

      p.Close

     

      If p.WaitProperty("Exists", False, 5000) Then

        Log.Message "The process was terminated."

      Else

        Log.Message "The process still exists."

      End If 

  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi
    Puyo,



    > Delay and waitProcess(xxx).Exists doesn't work for me.

    That's strange...

    What about this untested VBScript:



    process.Close

    While process.Exists

        Delay 500

    Wend