pradeep,krishna has asked for the wisdom of the Perl Monks concerning the following question:
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. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Controlling the execution.
by shmem (Chancellor) on Feb 03, 2014 at 10:54 UTC | |
by Corion (Patriarch) on Feb 03, 2014 at 11:11 UTC | |
by pradeep,krishna (Scribe) on Feb 04, 2014 at 04:18 UTC | |
by pradeep,krishna (Scribe) on Feb 04, 2014 at 04:18 UTC | |
|
Re: Controlling the execution.
by dasgar (Priest) on Feb 03, 2014 at 14:03 UTC | |
by pradeep,krishna (Scribe) on Feb 04, 2014 at 04:21 UTC |