Simulating mouse clicks on Mac OSX does not work for some applications.

Posted by Thomi on Stack Overflow See other posts from Stack Overflow or by Thomi
Published on 2010-03-03T08:52:06Z Indexed on 2010/03/08 2:12 UTC
Read the original article Hit count: 385

Filed under:
|
|
|

Hi,

I'm writing an App for Mac OSX 10.6 and later in C++. One part of theapp needs to simulate mouse movement and mouse clicks. I do this currently by posting CGEvent objects using CGEventPost(kCGHIDEventTap, event);.

This works, for the msot part - I can simulate mouse movement and clicks just fine, but it seems to fail in some areas. For example:

  • In Mozilla firefox & Safari, I can click on all the menus, but cannot click on a link within a website. When I try, the link is highlighted, but the browser never follows the link. However, I can right-click on a link, select "open link in new tab", and everything works as expected.
  • I can click on the "Dashboard" icon to brink up the dashboard, but I cannot click on the "i" button on any of the dashboard widgets.

This inconsistency is along application boundaries - Does anyone have any idea what the cause might be?

© Stack Overflow or respective owner

Simulating mouse clicks on Mac OSX does not work for some applications.

Posted by Thomi on Stack Overflow See other posts from Stack Overflow or by Thomi
Published on 2010-03-03T08:52:06Z Indexed on 2010/03/08 10:21 UTC
Read the original article Hit count: 385

Filed under:
|
|
|

Hi,

I'm writing an App for Mac OSX 10.6 and later in C++. One part of theapp needs to simulate mouse movement and mouse clicks. I do this currently by posting CGEvent objects using CGEventPost(kCGHIDEventTap, event);.

This works, for the msot part - I can simulate mouse movement and clicks just fine, but it seems to fail in some areas. For example:

  • In Mozilla firefox & Safari, I can click on all the menus, but cannot click on a link within a website. When I try, the link is highlighted, but the browser never follows the link. However, I can right-click on a link, select "open link in new tab", and everything works as expected.
  • I can click on the "Dashboard" icon to brink up the dashboard, but I cannot click on the "i" button on any of the dashboard widgets.

This inconsistency is along application boundaries - Does anyone have any idea what the cause might be?

© Stack Overflow or respective owner

Related posts about c++

Related posts about mac