Getting the state of the keys using python or ruby

Eric Gorr mailist at ericgorr.net
Wed Jul 30 07:54:15 PDT 2008


What I need to be able to do is simply determine if the option key is  
being pressed.

Is it possible to write a python or ruby script to provide this  
information?

It would need to be executable from the command line and send the  
output to stdout. If the script reported the state of all of the keys  
on the keyboard, that would be fine.

I can, of course, write a small unix command line tool that would make  
a call to the GetKeys carbon function, but was hoping to find  
something that already works and save the small amount of work  
involved in doing this small part of the task.

Thank you.


This used to be possible via AppleScript using Jon's Commands OSAX,  
but unfortunately, this OSAX doesn't work on intel macs (yet?).



More information about the MacOSX-dev mailing list