Jump to content

HoangDung

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by HoangDung

  1. #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example()     Local $sOutput = "" Local $iPID = Run(@ComSpec & " /c " & 'timeout /t 10 & netsh wlan show interfaces' , "", @SW_HIDE, $STDERR_MERGED+$STDIN_CHILD)      ; Local $iPID = Run('timeout /t 10 & netsh wlan show interfaces', "", @SW_HIDE, $STDERR_MERGED)     ProcessWaitClose($iPID,15000)     Do         $sOutput = StdoutRead($iPID)         If $sOutput <> "" Then MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput)     Until @error ; Exit the loop if the process closes or StdoutRead returns an error. EndFunc   ;==>Example The TIMEOUT command run from a batch job exits immediately and returns "ERROR: Input redirection is not supported, exiting the process?
  2. This is the function that returns the result from cmd, initially i connect to the network wait then i make a call to the above _GetDOSOutput($sCommand) function i want to wait 1 period of time netsh wlan connect name="name" actually but after starting to execute the netsh wlan show interfaces command i tried adding a timeout command it seems to have ignored the timeout command? #include <WindowsConstants.au3> #include <Constants.au3> Func _GetDOSOutput($sCommand) Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $sOutput = '' Local $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput &= StdoutRead($iPID, False, False) If @error Then ExitLoop EndIf Sleep(10) WEnd Return $sOutput EndFunc Local $sCommand= 'netsh wlan delete profile name="wait" & netsh wlan connect name="name" interface="Wi-fi" & netsh wlan show interfaces' MsgBox(0,0,_GetDOSOutput($sCommand))
×
×
  • Create New...