sub ScreenLooker() { # ScreenLooker is the client # Give server time to set up socket server sleep(1); my $socket = IO::Socket::UNIX->new( Type => SOCK_STREAM, Peer => $socketpath, ) or croak($!); $socket->blocking(0); while($keepRunning) { my $img = screenshot(); # Check idea lister my $ideasfound = findClickableStuff($img, $idealisterx, 'Idea lister', 1, $socket); if($ideasfound) { # Don't spend watts on thing maker when we still have ideas #print "Still have ideas left!\n"; } else { # Check thing maker findClickableStuff($img, $thingmakerx, 'Thing maker', 1, $socket); } my $getline = readSocket($socket); if($getline eq 'ABORT') { print "MouseClicker wants to abort, exiting ScreenLooker\n"; $keepRunning = 0; } } exit(0); }