Jump to content

Does RunWait() have a timeout?


Recommended Posts

I have an automated script that runs that I'd like to be initiated by an AutoIt script, and then I'd like to have the AutoIt script complete some other tasks as well. The script that's being initiated by AutoIt runs about 4-6 hours. Will my AutoIt script die in that time?

Thanks,

Michie

Link to comment
Share on other sites

Your script would not die but waiting for ending the startet process. After that it will execute the rest of your scriptcode. While waiting it will do nothing else only waiting, your script is frozen in this time. Run instead of RunWait will immediately return the pid and execute the rest of your scriptcode.

Link to comment
Share on other sites

  • 3 weeks later...

Hi.

You can use $PID=Run("command") instead of RunWait("command"), *IF* you intend to watch progress indicating things like file time stamps, Process List entries, or to force a termination, if the launched task takes too long.

The called task ended, when $PID doesn't exist any more as a process.

 

As AutoBert has pointed out already, with the use of "RunWait()" your script will sit there doing nothing, until the launched process terminates.

 

So the natural timeout is the next power outage, in maximum "next big bang" :D

 

 

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

If the runwait operation takes so long, I see no reason not to do your other tasks immediately.

Perhaps with something like this.

Func _RunWaitEx($program, $workingdir = "", $show_flag = Default, $opt_flag = Default, $timeout = 0)
    
    $pid = Run($program. $workingdir, $show_flag, $opt_flag)
    
    Do 
        ; Add some timeout code if desired
        _MyOtherTasks()
    Until Not ProcessExists($pid)
    
    _Finally()
    
EndFunc

Func _MyOtherTasks()
    ;tasks
EndFunc

Func _Finally()
    ;complete stuff
EndFunc

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...