Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Win32::GuiTest module application problem

by GrandFather (Sage)
on Oct 19, 2016 at 07:39 UTC ( #1174278=note: print w/replies, xml ) Need Help??


in reply to Win32::GuiTest module application problem

The issue is that you only search for the window once. $window[0] doesn't automatically update as the window state changes. You need to test each time through the loop. The test code cleans up a little by putting it in a sub:

use strict; use warnings; use Win32::GuiTest; while (my $window = findWindow("Calculator")) { print("calculator window is open\n"); sleep 2; } print "Calculator window closed\n"; sub findWindow { my ($caption) = @_; my @windows = Win32::GuiTest::FindWindowLike(undef, "Calculator"); return $windows[0]; }

Prints (for my test):

calculator window is open calculator window is open calculator window is open calculator window is open Calculator window closed
Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^2: Win32::GuiTest module application problem
by ankit.tayal560 (Beadle) on Oct 19, 2016 at 10:13 UTC

    got my mistake. Thanks a lot for you guidance and help

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1174278]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-07-17 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (374 votes). Check out past polls.

    Notices?