Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Monday, June 2, 2008

Controlling the mouse in OS X

Monday, June 2, 2008   

Has anyone seen Flash (AIR, executable, etc.) that controls the x, y position of the SYSTEM mouse?

We can easily hide the system cursor, use a custom cursor, restrict the position of that custom cursor Sprite, but what I'd really like to do is to be able to control the x, y position of the OS X mouse. If its within a certain range, move it with code. I am wondering if AppleScript might be able to do this, or some other method.

I found this method below in an Apple technote, but it's deprecated.

CGDisplayErr CGDisplayMoveCursorToPoint(
CGDirectDisplayID display, CGPoint point);
This is a really strange thing to want to do, but I am wondering if there is any way at all. Flash needs to send the commands... can it be done via Python maybe or something?

If someone has done this, please share ;)

Update:
I found this link. However I'm not sure how I'd actually call the method I need.
 
 Return to the main page
Comments:

There are currently 2 Comments:

Anonymous andrew wright said...
“I've been able to get this going with java and particularly the java.awt.Robot class. It wouldn't take much to set up a socket server to receive the commands from an air app.

Cheers,

A.”
 
Anonymous andrew wright said...
June 3, 2008 2:02 AM
“hey mate. i just tried to use your contact form to send you a link to an example i knocked up for you and it said "do NOT try to do that" or something along those lines. Anyhow, in case the email didn't go through the link to the source is available at

http://lithium.codelib.net.au/andrew/CursorController.zip

feel free to use it how you wish if you think it's useful.

Cheers,

Andrew.”
 
 Leave a comment