Problem with sendkeys function

NJudson

Who farted?
Local time
Today, 14:44
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.
 
Sorry i don't have a lot of experience with this but something to try. Change that last statement to
Code:
SendKeys "password {enter}", True
It could be that the sendkeys is processing the {enter} before the text? I don't much care for sendkeys so I am not 100% positive on this but give it a whirl.
 
Thanks. I tried changing it to true again and it works now. I had them all set to true before but it wouldn't work. I'm not at expert at any of this by any means so sometimes if I don't understand something I just have to throw my hands up in the air and wonder why I just don't go move to a cabin in the mountains with no electricity/technology or running water and have my trusty swiss army knife to keep me company. :rolleyes:
 

Users who are viewing this thread

Back
Top Bottom