#!/usr/bin/perl
#----------------------------------------------------------------------#
# X11::GUITest (kphone_ok.pl; v1.0, 23 January 2007)
# Notes: Automatically click the OK button that pops up in kphone
# 	when a call request times out.
#
# 	KDE 3.5
# 	KPhone 4.2
# 	X11-GUITest 0.21
#----------------------------------------------------------------------#

use strict;
use warnings;

use X11::GUITest qw/
	FindWindowLike
	ClickWindow
	SendKeys
	SetEventSendDelay
	SetKeySendDelay
/;

my @MainWin = ();

print "$0: Script start.\n";

SetEventSendDelay(50);
SetKeySendDelay(50);

@MainWin = FindWindowLike('KPhone') or die('Could not find timeout window!');
print "Call Failed window found, clicking OK...\n";

foreach my $MainWin (@MainWin) {
	ClickWindow($MainWin);
}

SendKeys('{SPC}');

print "$0: Script end (success).\n";

