Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6020091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:31:03+00:00 2026-05-23T03:31:03+00:00

I need to get the mouse to click on a spot on the screen,

  • 0

I need to get the mouse to click on a spot on the screen, to be specific a flash object in safari….
Id tried to do this with applescript but it didnt work. Then I found this script on the internet.

    // File: 
    // click.m
    //
    // Compile with: 
    // gcc -o click click.m -framework ApplicationServices -framework Foundation
    //
    // Usage:
    // ./click -x pixels -y pixels 
    // At the given coordinates it will click and release.


    #import <Foundation/Foundation.h>
    #import <ApplicationServices/ApplicationServices.h>


    int main(int argc, char *argv[]) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSUserDefaults *args = [NSUserDefaults standardUserDefaults];


    // grabs command line arguments -x and -y
    //
    int x = [args integerForKey:@"x"];
    int y = [args integerForKey:@"y"];


    // The data structure CGPoint represents a point in a two-dimensional
    // coordinate system.  Here, X and Y distance from upper left, in pixels.
    //
    CGPoint pt;
    pt.x = x;
    pt.y = y;


    // This is where the magic happens.  See CGRemoteOperation.h for details.
    //
    // CGPostMouseEvent( CGPoint        mouseCursorPosition,
   //                   boolean_t      updateMouseCursorPosition,
   //                   CGButtonCount  buttonCount,
  //                   boolean_t      mouseButtonDown, ... )
  //
  // So, we feed coordinates to CGPostMouseEvent, put the mouse there,
 // then click and release.
 //
 CGPostMouseEvent( pt, 1, 1, 1 );
 CGPostMouseEvent( pt, 1, 1, 0 );


[pool release];
return 0;
}

I have only scripted in applescript so I didnt quite understood it

but when I activate it it clicks on the top left

but here is my question, what should I chance in the script to make it click other places than in the top corner

more info about the script on this website: http://hints.macworld.com/article.php?story=2008051406323031

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:31:04+00:00Added an answer on May 23, 2026 at 3:31 am

    This is stuff that you learn in most introductory programming courses. A complete answer would be very long, so I just tell you a few cornerstones:

    • The program that you downloaded is not a script
    • It’s objective-C-sourcecode
    • You need to learn how to work with the Terminal application (the command line).
    • You need to learn how to invoke commands on the terminal (e.g. gcc)
    • You have to understand the meaning of the word compile. In this case it’s something the author wanted you to do at the command line.

    Second step:

    • // starts a comment in Objective C
    • gcc ... is the command that should be executed on the command line to compile the program
    • ./click is what you do to invoke the program (after you compiled it 🙂 )

    gcc -o click click.m -framework ApplicationServices -framework Foundation
    means:

    • gcc: Gnu C Compiler
    • -o click: The program should be named click
    • click.m: This should be the name of the source code (the file that you called ‘script’)

    hope this helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the position of the mouse on click in a form,
I have linq request. I need get item.Title in select. how do this? var
I need to get the contents from this URL http://google.fr/ok in a NSString can
I need to store a mouse click event whenever a user clicks on a
I need an advice on adding event (mouse click for that matter) in the
I need to get the relative position of mouse pointer in the window in
I need a rollover popup based on mouse click location (I cannot exactly use
Is there any way to get the object under the mouse in Excel sheet
I need get the id of an images which is place inside a datatemplate..
Just need get some vals located in application.ini(main ini) in the Controller plugin I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.