pradeep,krishna has asked for the wisdom of the Perl Monks concerning the following question:

Hai monks.

I have the following code to login into server.

use Win32::GuiTest qw(FindWindowLike GetListText MouseClick PushButton + PushChildById GetChildWindows SetFocus SelListViewItemText SelTabIte +mText GetFocus WaitWindow SendKeys GetFocus PushChildButton); system('"start %windir%\system32\mstsc.exe"'); $Win32::GuiTest::debug = 0; $max_Sleep_time=5; WaitWindow("Remote Desktop Connection",$max_Sleep_time); @windows = FindWindowLike(0, "Remote Desktop Connection"); for (@windows) { $fc_hwnd = GetFocus( $_ ); SendKeys($fc_hwnd ,"Server_name"); PushChildButton( $_, 1); $max_Sleep_time=20; WaitWindow("Windows Security",$max_Sleep_time); @windows_seq = FindWindowLike(0, "Windows Security"); for (@windows_seq) { PushChildButton( $_, "Use another account"); SelTabItemText( $_, "Use another account"); SelListViewItemText( $_, "Use another account"); @wnds = GetChildWindows($_); PushButton("Use another account"); MouseClick("Use another account",$_); $f=$_; for(@wnds) { $txt = GetListText($f,$_); print "$txt : $_\n"; MouseClick( $_ ,$f); sleep(2); } #--$fc_hwnd = GetFocus( $_ ); #--SendKeys($fc_hwnd ,"Password01"); #--PushChildButton( $_, "OK"); } }


After providing the server name, the connect button is clicked and the windows security window is opened. In this window there are two options, The first one is With my user name(Pradeep) and the other is "Use another account". By default the focus and the cursor is at the password box of the first option. I want to login with the other user credentials so want to click on "Use another account" to this I have used so many functions individually i the program above (For my convenience I have put all the functions in the code given above), But none of the functions were successful in clicking the "Use another account" option.

Please Help me out in solving this problem.

Thanks in advance.

Pradeep Krishna :)

  • Comment on How to perform click operation on 'Use another account' Option in the 'Windows Security' Window which popups in 'Remote Desktop Connection' process?
  • Download Code

Replies are listed 'Best First'.
Re: How to perform click operation on 'Use another account' Option in the 'Windows Security' Window which popups in 'Remote Desktop Connection' process?
by Kenosis (Priest) on Feb 07, 2014 at 05:27 UTC
Re: How to perform click operation on 'Use another account' Option in the 'Windows Security' Window which popups in 'Remote Desktop Connection' process?
by Anonymous Monk on Feb 07, 2014 at 08:02 UTC

    But none of the functions were successful in clicking the "Use another account" option.

    Why do you think that is?

    What do you think you should try next?

    Are you using any of "the spy" tools available?

      I want to login with different user credentials. so i want to click on "Use another account".
      Sorry, I have not yet used "the spy" tools as I am new to perl I have no knowledge on "the spy" tools.

      I think, I will have to perform that function through AutoIT and converting that code to exe and then calling it in my perl script.....

        "the spy"

        See this collection of win32 tutorials/examples for a link to the spy

        Win32 programming is very laborious and requires a great deal of win32 knowledge (in addition to a win32 machine:), error checking becomes very important (sending a click doesn't guarantee you actually clicked your target, or the new window/dialog has shown yet ... sometimes you have to wait for it)

        I think, I will have to perform that function through AutoIT and converting that code to exe and then calling it in my perl script.....

        Sounds like a plan, the AutoIt folks seem to like win32 a lot :) and work with it a lot:) and make working with win32 a lot easier :)

        FWIW, if you look at http://search.cpan.org/~shimi/Win32-Watir-0.06-withoutworldwriteables/MANIFEST or Win32::IEAutomation you can see they're using AutoIt COM interface from perl :)

        lib/Win32/Watir/AutoItX.chm lib/Win32/Watir/AutoItX3.dll lib/Win32/Watir/AutoItX3_x64.dll

        Good luck:)