KickStarter15 Posted August 10, 2018 Share Posted August 10, 2018 Hi Experts, I've got a small issue right now about opening a file .log and .xml where I need to pause first the script up until these two files were closed. ShellExecute(@ScriptDir & "\Log\Validator.log") Sleep(2000) ShellExecute(@ScriptDir & "\Sample.xml") ; pause the script here until this xml will close. I tried "WinWait()" and "WinWaitActive()" but the script will continue after few seconds declared and if I won't add the second to display, the script won't continue. Any idea how to handle this Experts? Thanks in advance. KS15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
AutoBert Posted August 10, 2018 Share Posted August 10, 2018 Seems to be easy. Just check the 2 pid's: ShellExecute return's a Pid for each process you start, so just loop until both ended. So this: $sPid1 = ShellExecute(@ScriptDir & "\Log\Validator.log") Sleep(2000) $sPid2 = ShellExecute(@ScriptDir & "\Sample.xml") ; pause the script here until this xml will close. $bOK =False Do $bOK = Not ProcessExists($pid1) If $bOK Then $bOK = Not ProcessExists($pid2) sleep(100) Until $bOK should do your job. KickStarter15 1 Link to comment Share on other sites More sharing options...
KickStarter15 Posted August 10, 2018 Author Share Posted August 10, 2018 Thanks @AutoBert. it's working. However, i switch the $sPid1 and $sPid2 to work. Thanks! Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. 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