#DEFINE INFINITE 0xFFFFFFFF
= WaitForSingleObject(hProcess, INFINITE)
Insert this line immediately after obtaining process and thread handles replacing the DO WHILE part.#DEFINE EXEC_NOWAIT 0 #DEFINE EXEC_AND_WAIT 1 oShell = CreateObject('WScript.Shell') oShell.Run("notepad c:\temp\myfile.txt", 1, EXEC_AND_WAIT)