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

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.

kelan


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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://320724]
help
Chatterbox?
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
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?