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

Re: Win32::GuiTest waiting for a window

by kelan (Deacon)
on Jan 12, 2004 at 18:35 UTC ( #320724=note: print w/replies, xml ) Need Help??

in reply to Win32::GuiTest waiting for a window

You're right, you do need to sleep. Here's what I use in one of my programs to wait for a window:

sub WaitFor { my $win; my $title = shift; while (!defined $win) { select(undef,undef,undef,0.1); # sleep for 1/10th of a second ($win) = FindWindowLike(0, $title); } return $win; }
This sub takes the window title as a parameter and then just sleeps until that window appears. It doesn't set it to the active window, but you can do that with something like this:
SetForegroundWindow(WaitFor("Some Title"));

Update: Remember to keep the parentheses around the $win in the loop, because FindWindowLike returns a list.


Perl6 Grammar Student

Replies are listed 'Best First'.
Re: Re: Win32::GuiTest waiting for a window
by primus (Scribe) on Jan 12, 2004 at 19:27 UTC
    thanks! worked like a charm

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2022-12-08 02:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found