use Win32::GuiTest qw(FindWindowLike GetListText MouseClick PushButton PushChildById GetChildWindows SetFocus SelListViewItemText SelTabItemText 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"); } }