How to "Click" Mouse

Seems to be my weekend for questions. I can position the cursor on the screen with the following script:

use framework "Foundation"
use framework "CoreGraphics"

set cursorPoint to current application's NSMakePoint(475, 545)
current application's CGWarpMouseCursorPosition(cursorPoint)

Now, what do I need to add to the script to initiate a “click”?
Thanks for any suggestions.

You are overcomplicating things :slight_smile:

tell application "System Events" to click at {475, 545}

Thank you. My better half tells me something similar all the time. I tend to really overthink things sometimes :grin:

In the application that I’m using this on, I need to click seven different boxes. I’ve tried various combinations of modifying the System Events script, with no success. Can you give me push in the correct direction please?

Can you provide more details? For example, are these boxes always in the same places on the screen? What is that application?
Two things I always check:

  1. Open Script Editor, press Cmd+Shift+O, check if your application is there. Best case scenario, the app already exposes a command for what you are trying to achieve through clicks.
  2. Open Automator, create new workflow, click record button, do the clicking in your app, then stop recording. “Watch me do” action will appear with a list of different steps. Select those step, Cmd+C, open Script Editor, Cmd+V - you’ll get something to work with.

Thank you for the reply. I never thought of using the Automator “Watch me do” feature, and it worked!