Locate the Child Windows



printf "Main      %6s %6s %6s %6s\n", GetWindowPos($Main);

my @children = GetChildWindows $Main;

foreach my $id (@children) {
  printf "%6s  %6s %6s %6s %6s\n", $id, GetWindowPos($id);
}


perl examples/X/xcalc12.pl


Main: 18874425
Focus: 18874425
Main           6     26    226    304
18874426       6     26    226    304
18874428     186    298     40     26
18874429     142    298     40     26
18874430      98    298     40     26
18874431      54    298     40     26
18874432      10    298     40     26
18874433     186    268     40     26
18874434     142    268     40     26
18874435      98    268     40     26
18874436      54    268     40     26
18874437      10    268     40     26
18874438     186    238     40     26
18874439     142    238     40     26
18874440      98    238     40     26
18874441      54    238     40     26
18874442      10    238     40     26
18874443     186    208     40     26
18874444     142    208     40     26
18874445      98    208     40     26
18874446      54    208     40     26
18874447      10    208     40     26
18874448     186    178     40     26
18874449     142    178     40     26
18874450      98    178     40     26
18874451      54    178     40     26
18874452      10    178     40     26
18874453     186    148     40     26
18874454     142    148     40     26
18874455      98    148     40     26
18874456      54    148     40     26
18874457      10    148     40     26
18874458     186    118     40     26
18874459     142    118     40     26
18874460      98    118     40     26
18874461      54    118     40     26
18874462      10    118     40     26
18874463     186     88     40     26
18874464     142     88     40     26
18874465      98     88     40     26
18874466      54     88     40     26
18874467      10     88     40     26
18874468      10     28    216     46
18874469      17     31    204     38
18874470     145     53     18     15
18874471     109     53     34     15
18874472      79     53     26     15
18874473      49     53     26     15
18874474      22     55     26     15
18874475      36     34    186     17
18874476      22     34     10     15


examples/X/xcalc12.pl
#!/usr/bin/perl

use strict;
use warnings;

use X11::GUITest qw(:ALL);

StartApp('xcalc');

my ($Main) = WaitWindowViewable('Calculator');
if (!$Main) {
  die("Couldn't find xcalc window in time!");
}
print "Main: $Main\n";

my $Focus = GetInputFocus();
print "Focus: $Focus\n";

if ($Focus != $Main) {
   die "The focus is not on the main window or you have two xcalcs open\n";
}

printf "Main      %6s %6s %6s %6s\n", GetWindowPos($Main);

my @children = GetChildWindows $Main;

foreach my $id (@children) {
  printf "%6s  %6s %6s %6s %6s\n", $id, GetWindowPos($id);
}





{
   my ($x, $y, $width, $height) = GetWindowPos($Main);
   MoveMouseAbs($x+2, $y-2);
   ClickMouseButton M_LEFT;
   SendKeys('c');
}