Control mouse position and clicking

Robert Kern robert.kern at gmail.com
Thu Nov 29 13:51:18 EST 2007


Bjoern Schliessmann wrote:
> Tony wrote:
> 
> [place mouse programmatically]
>> well, you can do it from Java, 
> 
> Are you absolutely positive? IIRC the Mac UI guidelines forbid such
> things, and there's no API function for it; so Java wouldn't have
> any chance.

There is an API for it. Not all programs have GUIs so the HIG doesn't restrict
the scope of the OS's APIs. Otherwise, one couldn't write assistive software or
userland drivers for new hardware. How do you think ControllerMate does what it
does?

  http://www.orderedbytes.com/controllermate/

In 10.4 and up, the recommended API is to use CGEventCreateMouseEvent and
CGEventPost. Before that, there was CGPostMouseEvent back to 10.0, but there are
situations where that can lock things up, so it is deprecated and not
recommended for use.


http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list