Guest lucindrea Posted November 14, 2004 Share Posted November 14, 2004 ok i have done a few searches and havent been able to come up with what i want to do .. basicly i'm running a command in a dos shell and it scrolls by going 10.1% 10.2% , etc up untill 99% .. it never acctully shows 100% , what happens is that it goes from 98% ish ( doesnt show every 0.1% , just what ever it's up to every 1 second ) then prints out a "DONE!" ... the problem i have is that this can take 30 seconds to go from 0% to 100% , or it can take 10 mins ... i need to be able to monitor the cmd window and wait for the DONE! to come up so i can go on to the next part of the autoit script. is their a simple way to do this? , if not checking for the DONE! , perhaps their is a way to monitor the process and if it uses less then 1% cpu i can concider it finished , of course i havent a clue how to do that either or if it's even possable. Link to comment Share on other sites More sharing options...
Guest lucindrea Posted November 14, 2004 Share Posted November 14, 2004 ok i was able to work this out myself , basicly i just ran the program directly and did a winwaitclose Link to comment Share on other sites More sharing options...
ezzetabi Posted November 14, 2004 Share Posted November 14, 2004 Or the good: $Pid = Run('filename.exe') ;Do what ever you want to do while waiting. ProcessWaitClose($Pid) Link to comment Share on other sites More sharing options...
flyingboz Posted November 14, 2004 Share Posted November 14, 2004 I'm also a big fan of checking the errorlevel returns in addition to the process existence -- trapping the return from the runwait will ensure that you got a DONE!, rather than FAILED!! Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
ezzetabi Posted November 14, 2004 Share Posted November 14, 2004 (edited) Yeah, lucindrea. Try to cast your program and check its exitlevel value, (if any) with echo %errorlevel% So you can use it the script E.g. $el = RunWait('myprogram.exe') Select Case $el = 1 msgbox(0,'Faliure','Gasp. Something goes wrong!') Case $el = 0 msgbox(0,'Success','Love it.') Case Else msgbox(0,'Well.. Dunno..','I can't tell') EndSelect Edit: fixed. Thanks sugi. Edited November 14, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
sugi Posted November 14, 2004 Share Posted November 14, 2004 Just a quick note: Run() cannot and does not return the errorlevel but RunWait() does. Link to comment Share on other sites More sharing options...
ezzetabi Posted November 14, 2004 Share Posted November 14, 2004 Yes, of course. Run() returns the Pid as shown in the other example of mine few posts before. Thanks Sugi. Link to comment Share on other sites More sharing options...
Guest lucindrea Posted November 17, 2004 Share Posted November 17, 2004 works great thanks , and the error checking is a nice bonus 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