APRES Posted August 11, 2005 Share Posted August 11, 2005 The first script I made ( HelloWorld ) should do the following Run ( "C:\putty.exe -load AT" ) WinActivate("192.168.10.1 - PuTTY" ) WinWaitActive ( "192.168.10.1 - PuTTY" ) Sleep(10000) ;pause 10 seconds WinActivate("192.168.10.1 - PuTTY" ) Send ( "login{ENTER}" ) Sleep(10000) ;pause 5 seconds WinActivate("192.168.10.1 - PuTTY" ) Then few times Send ( "some keystroke") Sleep(2000) WinActivate("192.168.10.1 - PuTTY" ) All of it I compiled and scheduled as wintask to execute nightly. It works well. But not always. Sometimes I come next day and see that it remains on login screen. It looks like some process running on computer takes it over. Therefore I used WinActivate for every step. But it doesn't help either. What am I doing wrong? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 11, 2005 Developers Share Posted August 11, 2005 try a WinWait() between the first 2 statements, because you need to pause to give Putty time to launch before activating... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
w0uter Posted August 11, 2005 Share Posted August 11, 2005 Sleep(10000) ;pause 5 seconds isnt right My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
APRES Posted August 11, 2005 Author Share Posted August 11, 2005 Sure. But it is not the cause of problem I guess. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted August 11, 2005 Share Posted August 11, 2005 (edited) and Send("{some keystroke}") Sleep(2000) WinActivate("192.168.10.1 - PuTTY" ) on ur send it should be send("{keystroke"}) Edited August 11, 2005 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 and Send("{some keystroke}") Sleep(2000) WinActivate("192.168.10.1 - PuTTY" )on ur send it should besend("{keystroke"})<{POST_SNAPBACK}>@thatsgreat2345,this does not look correct send("{keystroke"})8) Link to comment Share on other sites More sharing options...
APRES Posted August 13, 2005 Author Share Posted August 13, 2005 Also adding of WinWait() didn't help. Today again program stopped at log in. Is there any way to go further? (to debug it somehow) Link to comment Share on other sites More sharing options...
Developers Jos Posted August 13, 2005 Developers Share Posted August 13, 2005 Also adding of WinWait() didn't help.Today again program stopped at log in. Is there any way to go further? (to debug it somehow)<{POST_SNAPBACK}>Add Opt("TrayIconDebug", 1) to your script to deterime where it is stopping..... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DaleHohm Posted August 13, 2005 Share Posted August 13, 2005 (edited) Also adding of WinWait() didn't help.Today again program stopped at log in. Is there any way to go further? (to debug it somehow)<{POST_SNAPBACK}>I find that the length of time required to get the "login as:" prompt in PuTTY can vary tremendously. Assuming that the first string you are sending is the username you may need to put a substantial Sleep in the code before you send it.Also, you can avoid the potential problem of another window taking focus by using ControlSend instead of Send (a ControlID is not actually required). Here is what works for me:Run ( "C:\putty.exe -load your-config" ) $title = "your-IP - PuTTY" WinWait($title ) $handle = WinGetHandle($title) Sleep(15000); sleep 15 seconds - just keep shorter than the login timeout ControlSend ( $handle, "", "", "username{ENTER}" ) ControlSend ( $handle, "", "", "password{ENTER}" )Edit: Just realized that since the window title won't change, there should be no need for the complexity of using the handle. This will work just as well:Run ( "C:\putty.exe -load your-config" ) $title = "your-IP - PuTTY" WinWait($title ) Sleep(15000); sleep 15 seconds - just keep shorter than the login timeout ControlSend ( $title, "", "", "username{ENTER}" ) ControlSend ( $title, "", "", "password{ENTER}" )Dale Edited August 13, 2005 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
APRES Posted August 13, 2005 Author Share Posted August 13, 2005 (edited) Thank you. Almost sure that just the difference between Send and ControlSend will makes a trick. "ControlSend" would act also if a control lost focus and "Send" won't , isnt'it? Edited August 14, 2005 by APRES 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