Jump to content

Telnet connection issues with Autoit


Recommended Posts

Hi, guys:

I'm try to use autoit to log in a power switch with telnet, but my internet connection is so unstable, so I constantly failed to enter my username or password:

My code: (Please forgive my programming skill, new to autoit)

run("C:\Windows\System32\telnet.exe")
 
WinWaitActive("C:\Windows\System32\telnet.exe")
send("o 10.1.30.160 {ENTER}")
 
WinWaitActive("Telnet 10.1.30.160")
Sleep(2000)
send("super{ENTER}")
 
sometime the internet is OK, I could successfully enter my username up to this step, but quite always it takes telnet like 20s to connect, so I always failed.
 
I was wondering, Is that possible for Autoit to achieve such an action that the script is able to automatically check if the telnet is really to take input, could be like "expect" in linux shell.
 
Also, I was thinking what is the way to ensure that my script only runs or takes action on that particular window? (i.e. it won't input the rest of my command on some other windows on the half way of running the the script if I accidentally click it.)
 
Cheers
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...