Hai monks...

I have two problems in the bellow code.

1) In the bellow code the execution stops after executing the code system('"%windir%\system32\mstsc.exe"');(opening Remote Desktop Connection), And restarts when I close the window poped by the exicution of it. To get the output I got to open another window of the same (mstsc.exe/Remote Desktop Connection) before closing the opened window. now it takes the other window for further execution.

2)After executing the code SendKeys("{ENTER}"); the process must wait till another window appears, but before the popup window appears, the process terminates without executing the following code. I tried with usleep(500000); with use Time::HiRes qw(usleep);, but it is also of no use.

use Win32::GuiTest qw(FindWindowLike GetWindowText SetForegroundWindow SendKeys); system('"%windir%\system32\mstsc.exe"'); $Win32::GuiTest::debug = 0; my @windows = FindWindowLike(0, "Remote Desktop Connection"); for (@windows) { print "$_>\t'", GetWindowText($_), "'\n"; SetForegroundWindow($_); SendKeys("{ENTER}"); my @windows1 = FindWindowLike(0, "Windows Security",10); for (@windows1) { print "$_>\t'", GetWindowText($_), "'\n"; SetForegroundWindow($_); SendKeys("P@ssword01"); } }

Please help in solving these.

Thanks in advance.

Pradeep Krishna. :)


In reply to Controlling the execution. by pradeep,krishna

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.