Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, it is possible. You can use the <a href="http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html" rel="noreferrer">Quartz Event Services</a> to simulate input events.</p> <p>Assuming C, I wrote this quick example:</p> <pre><code>#include &lt;ApplicationServices/ApplicationServices.h&gt; #include &lt;unistd.h&gt; int main() { // Move to 200x200 CGEventRef move1 = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, CGPointMake(200, 200), kCGMouseButtonLeft // ignored ); // Move to 250x250 CGEventRef move2 = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, CGPointMake(250, 250), kCGMouseButtonLeft // ignored ); // Left button down at 250x250 CGEventRef click1_down = CGEventCreateMouseEvent( NULL, kCGEventLeftMouseDown, CGPointMake(250, 250), kCGMouseButtonLeft ); // Left button up at 250x250 CGEventRef click1_up = CGEventCreateMouseEvent( NULL, kCGEventLeftMouseUp, CGPointMake(250, 250), kCGMouseButtonLeft ); // Now, execute these events with an interval to make them noticeable CGEventPost(kCGHIDEventTap, move1); sleep(1); CGEventPost(kCGHIDEventTap, move2); sleep(1); CGEventPost(kCGHIDEventTap, click1_down); CGEventPost(kCGHIDEventTap, click1_up); // Release the events CFRelease(click1_up); CFRelease(click1_down); CFRelease(move2); CFRelease(move1); return 0; } </code></pre> <p>And assuming GCC, compile with:</p> <p><code>gcc -o program program.c -Wall -framework ApplicationServices</code></p> <p>Enjoy the magic.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload