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");

In reply to Re: script not working by Urthas
in thread script not working by Raj07

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.