Jump to content

How to Read data present on mainframe


Recommended Posts

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.

image.png.a929be485c385c8fc1fc3774776be97e.png

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. 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...