Code for getpoints.pl

#!perl -w
# select point locations
use Win32::GuiTest qw(FindWindowLike GetWindowText );

$Win32::GuiTest::debug = 0; # Set to "1" to enable verbose mode
my @windows = FindWindowLike(0, "- IrfanView", "");
my $win= $windows[0];

for (@ARGV) { print "$_\n" }
print STDERR "Click on 1,1 to quit";
my ($yy,$xx)= (0,0);
while (1) {
    select undef,undef,undef, 0.01;
    my $text = GetWindowText($win);
    next unless $text =~ /^XY:\((\d+),(\d+)\)/;
    next if $xx==$1 and $yy==$2;
    $xx=$1; $yy=$2;

    exit 0 if $xx==1 and $yy==1;

    print "$xx , $yy\n";

}

Code for imageclick.pl

#!perl -w
# Simple web script to get point locations
use IO::Socket;

$outfile = $ARGV[0] || "/dev/null";
open OF, ">$outfile" or die $!;

$PORT = 9001;
$image= "c:/home/adler/work/2002/biopeak/spectra-enlarged.gif";

$server = IO::Socket::INET->new( Proto     => 'tcp',
                                 LocalPort => $PORT,
                                 Listen    => 5,
                                 Reuse     => 1);

die "can't setup server" unless $server;
print "[Server $0 accepting clients]\n";

while ($client = $server->accept()) {
    while (<$client>) {
        s/[\012\015]+$//;
        print ">>>$_<<<\n" if /^GET/;
        print OF "$1,$2; #x,y\n" if /^GET .*posn.x=(\d+)&posn.y=(\d+).*/;
        last if /^$/;
    }
    print $client qq{HTTP/1.1 200 OK
Content-Type: text/html

<HTML><TITLE>GET POINTS</TITLE>
    <BODY><FORM method="GET" action="http://localhost:9001/">
    <input type="image" name="posn" src="file:///$image" />
    </H1></BODY></HTML>\n\n};
    close $client;
}