Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Move and click the mouse via code' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Move and click the mouse via code
Authored by: alichino on Oct 23, '09 07:53:28AM

CGPostMouseEvent has been deprecated in SnowLeopard.

You can replace it with something like

CGEventRef mouseDownEv = CGEventCreateMouseEvent (NULL,kCGEventLeftMouseDown,pt,kCGMouseButtonLeft);
CGEventPost (kCGHIDEventTap, mouseDownEv);

CGEventRef mouseUpEv = CGEventCreateMouseEvent (NULL,kCGEventLeftMouseUp,pt,kCGMouseButtonLeft);
CGEventPost (kCGHIDEventTap, mouseUpEv );

With some minor adjustments (see Apple docs) you can also send wheel events, drag the mouse and the like.

Cheers



[ Reply to This | # ]