bigdogdan2 Posted February 7, 2014 Share Posted February 7, 2014 (edited) I am wondering if someone could tell me if AutoIt has any Q&A+timeout+fallback mechanism that is similar to Expect. In a brief summary for those who aren't familiar with Expect, Expect is a command line automation tool that is focused on Q&A+timeout sets. You would Send() a command and Expect() some string on the screen with X seconds. Depending on if the result is Found() or not, different commands would be executed. The user can Expect() multiple options as well, so that the target program can be dynamically(yet finitely determined) managed. I would like to telnet to my linux machine. Check check the memory and write to a log the results of the test. I'm using putty because i didn't have a good telnet program in windows. Run("c:/putty.exe -load dan") AutoItSetOption("SendKeyDelay", 200) Send("user{ENTER}") Sleep(500) Send("password{ENTER}") Sleep(500) Send("memtest{ENTER}") Send("echo $?") ** If output is 0 ** Send("echo PASS > log.txt") ** If output is 1 ** Send("echo FAIL > log.txt") ** If output is hung (timeout) ** Send("echo HUNG > log.txt") I'll be running more system checks along with this, but this would be a good basis to start on. Also does autoit have telnet type of routines already? Thanks, Dan Edited February 7, 2014 by bigdogdan2 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 7, 2014 Moderators Share Posted February 7, 2014 As far as "telnet routines", have you searched the forum yet? A simple search returned c. 600 results for me. As far as your Expect() function, AutoIt doesn't have any pre-defined "wait x number of seconds and if no response do this" function. It does, however, support a wide array of error checking to confirm you get the results you're after. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Gianni Posted February 7, 2014 Share Posted February 7, 2014 You could use "Console Telnet". It allows to redirect the STDIN and STDOUT so you can better manage it with autoit via streams instead of send()>Here I posted an example on how to use it. Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
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