Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Fetch the list of Child Windows

  • GetChildWindows
  • GetWindowName
my @children = GetChildWindows $Main;

foreach my $id (@children) {
  my $name = GetWindowName($id) || '';
  print "Child: '$id'  '$name'\n";
}
perl examples/X/xcalc11.pl

Non of them has a title, this seem to be like a dead-end, but wait a second, maybe we can find the location of the child windows.

#!/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";
}


my @children = GetChildWindows $Main;

foreach my $id (@children) {
  my $name = GetWindowName($id) || '';
  print "Child: '$id'  '$name'\n";
}





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