Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2018-09-19 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (163 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!