Jump to content

Window expect functionality


Recommended Posts

Hi there,

I'm a newb when it comes to using AutoIt, but you know, this is a really great tool to create quick running progs. Thanks to the developers of this tool. You guys rock!

Quick question, but I was wondering...is there is any sort of functionality that allows for waiting for a string of text coming from a window before resuming a script? I ask this because in an app that I'm trying to make, I'm trying to create an autologin program and execute some shell commands. I want to basically be able to have the program throw a new window (in PuTTY) to SSH to a box, when it prompts for username, the username is entered automatically. Then, when the response comes back, if it asks for password, the password is entered automatically. Here's the code:

WinWaitActive("PuTTY Configuration")
ControlSend("PuTTY Configuration", "", "Edit1", $strServer)
ControlClick("PuTTY Configuration", "", "&Open")

ControlSend($strServer & " - PuTTY", "", "", $strUsername & "^M")
ControlSend($strServer & " - PuTTY", "", "", $strPassword & "^M")

As it stands right now, I'm coding this app and just putting Sleep(1000) or something like that to time a response and wait for it to come back. If there is something that could just expect a response rather than setting an exact amount of time to wait before going further, that would be cool. What do you think?


Link to comment
Share on other sites

Not sure if you can get a hook to the putty terminal window but if you can then you should take a look at ConsoleRead and associated functions in the help file.

Link to comment
Share on other sites

I don't think Putty uses a real console window, so i don't think STD functions would apply. But you could use PLink, the command line version of Putty. That'd probably work fairly well.

Hmm...I'll take a look into this and let you know what I find. Thanks for the replies!

Link to comment
Share on other sites

  • 2 years later...

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

  • Recently Browsing   0 members

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