HoangDung Posted December 6, 2022 Share Posted December 6, 2022 #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? Link to comment Share on other sites More sharing options...
spudw2k Posted December 7, 2022 Share Posted December 7, 2022 (edited) Seems like timeout.exe doesn't support Input or Output redirection. I say this because removing $STDIN_CHILD has no effect--still produces same error. Here is a "hack" to do the equivalent of "timeout /t 10", but perhaps resorting to using AutoIt sleep() would be just a well suited? Local $iPID = Run(@ComSpec & " /c " & 'choice /t 10 /c ab /d a >nul & netsh wlan show interfaces' , "", @SW_HIDE, $STDERR_MERGED) Edited December 7, 2022 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Nine Posted December 7, 2022 Share Posted December 7, 2022 Here a way to perform a MsgBox with no flicker and a count down : #include <Constants.au3> Global $iTimer Example(10) Func Example($iTime) Local $sCommand = ' /AutoIt3ExecuteLine "ConsoleWrite(MsgBox(' & $MB_OKCANCEL & ', ''Count Down'', ''Execution will start in ' & $iTime & ' secs'', ' & $iTime & '))"' Local $iPID = Run(@AutoItExe & $sCommand, "", @SW_SHOW, $STDERR_MERGED) $iTimer = $iTime AdlibRegister(CountDown, 1000) While ProcessExists($iPID) Sleep(50) WEnd AdlibUnRegister(CountDown) Local $iResp = StdoutRead($iPID) Switch $iResp Case $IDTIMEOUT ConsoleWrite("Time Out" & @CRLF) Case $IDOK ConsoleWrite("OK" & @CRLF) Case $IDCANCEL ConsoleWrite("Cancel" & @CRLF) EndSwitch EndFunc Func CountDown() $iTimer -= 1 ControlSetText("Count Down", "", "Static1", "Execution will start in " & $iTimer & " secs") EndFunc pixelsearch 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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