in reply to script not working
Oh my good Lord, format that code by wrapping it in html code blocks:
use Win32::GuiTest qw/:ALL/; $Win32::GuiTest::debug = 1; my $fgWindow1= 0; # Foreground Window system("c:\\MyApp\\abcd.exe"); $fgWindow1=WaitWindowLike( 0 , "^MyApp Administration"); SetForegroundWindow($fgWindow1); my @Mwnd= FindWindowLike(0 , "^MyApp Administration"); SetForegroundWindow( $Mwnd 0 ); if( not @Mwnd ) { printf( "Cannot find window with title/caption MyApp Administratio +n \n"); } else { printf( "Window handle of MyApp application is %x \n", $Mwnd 0 ); } if(IsWindowVisible($Mwnd 0 )) { printf("Application launched successfully \n"); } else { printf("Application launching is failed \n"); }
Anyways, if nothing else you are using $Mwnd 0 when you almost certainly mean $Mwnd[0]. I also see if( not @Mwnd ) instead of if(! @Mwnd), although it's pointless to check this after you've already attempted to use the first element in the call to SetForegroundWindow(). You are also using a superfluous call to printf when print will do just fine:
print( "Cannot find window with title/caption MyApp Administration \n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: script not working
by almut (Canon) on Sep 25, 2009 at 08:42 UTC | |
by Raj07 (Initiate) on Sep 25, 2009 at 10:09 UTC | |
|
Re^2: script not working
by jevaly (Sexton) on Sep 25, 2009 at 09:03 UTC | |
by broomduster (Priest) on Sep 25, 2009 at 09:21 UTC | |
by Raj07 (Initiate) on Sep 25, 2009 at 10:11 UTC |