discipulus

Does RunWait() have a timeout?

5 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

1 person likes this

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

Share this post


Link to post
Share on other sites
1 hour ago, rudi said:

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

LMAO


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
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.

Share this post


Link to post
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