Sijo Posted February 7, 2024 Posted February 7, 2024 Hi All, I am new to AutoIT and would really appreaciate your help. I have a case where I need to read the data present on the mainframe. I need to read the UserId Code I have tried is this: $PID= ShellExecute("") While ProcessExists($PID) $output &= StdoutRead($PID) Sleep(100) WEnd MsgBox(0,"Ready","Read from other app's StdOut: " &$output) Please let me know if I am missing anything.
Nine Posted February 7, 2024 Posted February 7, 2024 Welcome. There is many things wrong with your code. Here my version to "discuss" with CMD. Use it as is WITHOUT any change to see if that works for you. Then you can start making modifications to adapt it to your MainFrame.exe #include <WinAPIConv.au3> #include <Constants.au3> Opt("MustDeclareVars", True) OnAutoItExitRegister(_Exit) Global $iPID = Run(@ComSpec, "", @SW_SHOW, $STDIN_CHILD+$STDERR_MERGED) ProcessWait($iPID) MsgBox ($MB_SYSTEMMODAL,"",ReadStream ($iPID)) Local $sRep While True $sRep = InputBox("Convo with DOS console", "Enter DOS command :", "", "", 500) If @error Then ExitLoop StdinWrite ($iPID, $sRep & @CRLF) MsgBox ($MB_SYSTEMMODAL,"", ReadStream($iPID)) WEnd Func ReadStream ($iPID, $iDelay = 300) Local $vData, $sStream Do Sleep ($iDelay) $vData = StdoutRead($iPID) If @error Then Exit ConsoleWrite("[ERROR] reading child Stream" & @CRLF) $sStream &= $vData Until $vData = "" Return _WinAPI_OemToChar ($sStream) EndFunc Func _Exit() StdioClose($iPID) ProcessClose($iPID) EndFunc “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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