NJudson
Who farted?
- Local time
- Today, 13:07
- Joined
- Feb 14, 2002
- Messages
- 297
I'm writing some code that will open a telnet session, login with username and password using the sendkeys command and then I want to be able to run a set of commands once logged in. I'm having a problem with what appears to be that the telnet session is losing focus.
Function telnet()
Call Shell("telnet", 1)
SendKeys """%c""", True 'this selects "Connect" from menu
Call sSleep(1000)
SendKeys "1", True 'this selects the IP address
Call sSleep(1000)
SendKeys "username {enter}", True
Call sSleep(1000)
SendKeys "password {enter}", False
Call sSleep(1000)
End function
When I run it the telnet opens fine. Then it sendskeys for the username fine, but when it runs the sendkeys for the password the focus appears to shift from the telnet window to my Access Module window and sends the password keys right on top of my code in the module window. How can I maintain the focus on the Telnet window while the code runs??? I really appreciate any help. Thanks.
Function telnet()
Call Shell("telnet", 1)
SendKeys """%c""", True 'this selects "Connect" from menu
Call sSleep(1000)
SendKeys "1", True 'this selects the IP address
Call sSleep(1000)
SendKeys "username {enter}", True
Call sSleep(1000)
SendKeys "password {enter}", False
Call sSleep(1000)
End function
When I run it the telnet opens fine. Then it sendskeys for the username fine, but when it runs the sendkeys for the password the focus appears to shift from the telnet window to my Access Module window and sends the password keys right on top of my code in the module window. How can I maintain the focus on the Telnet window while the code runs??? I really appreciate any help. Thanks.