Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1174278]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2019-02-24 03:18 GMT
Find Nodes?
    Voting Booth?
    I use postfix dereferencing ...

    Results (121 votes). Check out past polls.

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