Jump to content

comd.exe - program done?


Guest lucindrea
 Share

Recommended Posts

Guest lucindrea

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

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

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 by ezzetabi
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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