#!perl # Keyboard Keys and Mouse Detection # Collected and adapted by David Seay use Mac::Events; use Mac::Events qw(@Event $CurrentEvent); use Mac::LowMem; use Mac::QuickDraw; $Event[keyDown] = \&keyDown_Handler; $Event[mouseDown] = \&mouseDown_Handler; print "Hold down the shift, control, option, and/or command keys and click the mouse or press a key on the keyboard. Type command period to quit.\n\n"; WaitNextEvent while !$flag; sub keyDown_Handler { my($ev) = @_; $k = chr($ev->character); $modKey = ($CurrentEvent->modifiers); print "KEY DOWN = $k\nMODIFIER KEY = $modKey\n\n"; if ($modKey == 256 && $k eq ".") { $flag = 1 } # COMMAND '.' QUITS THE PROGRAM } sub mouseDown_Handler { $modKey = ($CurrentEvent->modifiers); $clk = LMGetMouseLocation(); ($horz, $vert) = ($clk->h, $clk->v); print "MOUSE CLICKED at H = $horz V = $vert\nMODIFIER KEY = $modKey\n\n"; } ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org