http://qs321.pair.com?node_id=301056


in reply to GUITEST module - FindWindow Question

The first parameter of FindWindowLike is window ID to start searching from. Usually you probably use 0, so that it starts with the Desktop (which is the ultimate parent of every window). What you should do is first use FindWindowLike to get your main apps window ID, then use that as the first argument in a subsequent call that loops until it finds the new window, like batkins suggested above. Something like this:

my ($mainapp) = FindWindowLike(0, 'FOO'); my $childwin; while (!$childwin) { select(undef, undef, undef, 0.1); # sleep for 1/10th second ($childwin) = FindWindowLike($mainapp, 'FOO'); } # do stuff with $childwin
Remember that FindWindowLike returns a list, so you need the parentheses around the variable if you're assigning to a scalar.

kelan


Perl6 Grammar Student