VarunVarma Posted February 6, 2009 Share Posted February 6, 2009 Hi! I am trying to write a script to enter a password in an RDP session login box: CODEOpt("SendKeyDelay", 250) Opt("WinTitleMatchMode", 4) Const $title = "ED - x.x.x.x - Remote Desktop" Const $id = "[CLASS:UIMainClass; INSTANCE:1]" Run("mstsc ""Connection.rdp"" /f") WinWaitActive($title) $handle = WinGetHandle($title) If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else Sleep("3000") $ret = ControlSend($handle, "", $id, "password{ENTER}") MsgBox(0, "Password Entry", $ret) EndIf The message box displays "1" - that is - success, but no data is entered into the password text entry field. Strangely enough, if I use a simple "Send" instead of "ControlSend", things work as expected - "MouseClick" also works as expected. Some of the other things I have tried: 1. Using "UIMainClass1" and "[CLASS:UIMainClass]" as the control identifiers 2. Calling "ControlFocus" before "ControlSend" 3. Using the title of window in "ControlSend" instead of the handle So, AutoIt guru's - here's the question - why? BTW, I realize there might be other ways of passing the login information to the RDP login session, but I would really like to find out why this is not working as expected. Thanks In Advance! -Varun Link to comment Share on other sites More sharing options...
Zedna Posted February 6, 2009 Share Posted February 6, 2009 Try: - Calling "ControlClick" before "ControlSend" - Use $id = "" and make Calling "ControlClick" or "ControlFocus" before "ControlSend" Resources UDF ResourcesEx UDF AutoIt Forum Search 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