Jump to content

Control a Telnet Session with AutoIT


Recommended Posts

Hello,

possibly you know my problem, that I want to control a telnet Session with autoit.

My Code is:

#include <GuiConstants.au3>

#include <Constants.au3>

Global $UserName = "*****", $IPAddress = "********"

EnvSet("TELNET_REDIR", "1")

$ourProcess = Run("C:\telnet\telnet.exe "&$IPAddress, "C:\telnet",1, $STDERR_CHILD + $STDOUT_CHILD)

While 1

If $ourProcess Then

$charsWaiting = StdoutRead($ourProcess)

If @error = -1 Then

$ourProcess = 0

MsgBox(0, "App Exited", "Process has exited...")

ContinueLoop

EndIf

If $charsWaiting Then

$currentRead = StdoutRead($ourProcess)

If StringInStr($currentRead, "********") <> 0 Then

StdinWrite($ourProcess, $UserName & @LF)

EndIf

EndIf

EndIf

WEnd

Exit

______________

So, my problem is, that if i write "$STDERR_CHILD + $STDOUT_CHILD" in the "Run"-Function, the telnet tries to connects to host, but I can only see a cursor at the left side of the telnet-window.

When I delete "$STDERR_CHILD + $STDOUT_CHILD" then I can see how the telnet connects to host and a login screen.

But I need the "$STDERR_CHILD + $STDOUT_CHILD" to read informations out of the console...

Can anybody help me?

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...