iamtheky Posted June 23, 2016 Share Posted June 23, 2016 (edited) Dont say stdout nor piping it to a file, nor to clip. I need to read the text that is in the window cmd.exe, is there any of the win* or _WinAPI_* stuff that might assist in reading the already populated console so i can capture that text? WinActivate works, WinWaitActive works, but read does not capture anything. I am running a bash command, and it returns data to the console, but this stream is unavailable via any of those mechanisms. This has been verified by a guy at MS who is developing this stuff. Edited June 23, 2016 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
iamtheky Posted June 24, 2016 Author Share Posted June 24, 2016 (edited) There has to be a better way: #include <WinAPIFiles.au3> #include <array.au3> opt("WinTitleMatchMode" , 2) _WinAPI_Wow64EnableWow64FsRedirection (False) $filename = "lstest.txt" If FileExists($filename) Then FileDelete($filename) $sCommand = "ls //bin/" filewrite($filename , $sCommand) $hCmd = run("cmd /k bash lstest.txt") sleep(10000) send("^a") send("^c") ProcessClose($hCmd) $aArray = stringsplit(StringRegExpReplace(ClipGet() , "\s\s+" , @LF) , @LF , 2) _ArrayDelete($aArray , ubound($aArray) - 1) _ArrayDisplay($aArray) Edited June 24, 2016 by iamtheky changed wait to a sleep since ^c kills scripts ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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