Jump to content

Recommended Posts

Posted

Hi,

Some one know how can I send timeout from _RunDOS command?

meaning if I do something with _RunDOS and I wish to kill it and cause program continue if after 5 seconds process executed with _RunDOS did not finish

pls help me...

Thanks!

Noa :-)

Posted

Why not use Run which Returns the PID and then ProcessClose($PID) as an Example e.g...

$sCommand = "start Http://www.autoitscript.com"
Global $iPID = Run(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
Global $iBegin = TimerInit()
While ProcessExists($iPID)
    If TimerDiff($iBegin) = 5000 Then
        ExitLoop
    EndIf
    Sleep(100)
WEnd
ProcessClose($iPID)

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Hi,

I built function doing:

Func _RunCommand($sCommand)
        Global $iPID = Run(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
        Global $iBegin = TimerInit()
        While ProcessExists($iPID)
            If TimerDiff($iBegin) = 100 Then
                ExitLoop
            EndIf
            Sleep(100)
        WEnd
        ProcessClose($iPID)
EndFunc

and I tried test it but it still take relatively a lot of time...

Thanks for your help!!

Noa :-)

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
  • Recently Browsing   0 members

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