kpu Posted October 6, 2005 Share Posted October 6, 2005 (edited) Does anyone know if or how you can set a time out on the RunWait Command?Here's the really short of what I have:$pw1 = "idontknow"$pw2 = "istilldontknow"RunWait(@ComSpec & " /c " & "net use \\" & $line & "\IPC$ /U:Administrator " & $pw1 & " > temp.txt", "", @SW_HIDE)RunWait(@ComSpec & " /c " & "net use \\" & $line & "\IPC$ /U:Administrator " & $pw2 & " > temp.txt", "", @SW_HIDE)It takes about 2 minutes for these two commands to check to see if they can connect. Any way to speed it up??Thanks, Edited October 6, 2005 by kpu http://www.kpunderground.com Link to comment Share on other sites More sharing options...
LxP Posted October 7, 2005 Share Posted October 7, 2005 Something like this should be close: $pw1 = "idontknow" $pw2 = "istilldontknow" $cmdStub = @comSpec & " /c " & "net use \\" & $line & "\IPC$ /U:Administrator " _runWaitTimeout(10, $cmdStub & $pw1 & " > temp.txt", "", @SW_HIDE) _runWaitTimeout(10, $cmdStub & $pw2 & " > temp.txt", "", @SW_HIDE) func _runWaitTimeout($timeout, $filename, $workDir = "", $flag = "") ; Returns 0 if finished normally ; Returns PID (> 0) if timeout was reached ; (PID can be used for further manipulation of the process) local $pid = run($filename, $workDir, $flag) local $start = timerStart() do processWaitClose($pid, 1) until not(processExists($pid)) or timerDiff($start) > ($timeout * 1000) return processExists($pid) endFunc Link to comment Share on other sites More sharing options...
kpu Posted October 7, 2005 Author Share Posted October 7, 2005 Thanks! I'll try it out. http://www.kpunderground.com 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