Hi , I've written a code which should do the following function :till the window which is matched is active my script should be paused and as soon as that window ends my script should end.

use strict; use warnings; use Win32::GuiTest qw(:ALL); my @window=FindWindowLike(undef,"Calculator"); while($window[0]) { print("calculator window is open"); sleep 2; }

Now this script is not performing the function I require it to do. what is happening is it is going in a infinite loop and after the calculator window is closed then also it is printing "calculator window is open" with 2 seconds gap each time and the script keeps running.

P.S. calculator is taken as an example only. I've tried this with few other windows as well. it does not work.

P.S. I am not getting any error message as the script keeps running and does not end.

Any suggestions or help is appreciated! Thanks in advance .


In reply to Win32::GuiTest module application problem by ankit.tayal560

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.