tell application "System Events"
click at {15, 15}
end tell
The following also works on my computer, but I’m not sure if it’s worth using, because the coordinates are global coordinates.
tell application "System Events" to tell process "Google Chrome"
set frontmost to true
delay 0.5
click at {15, 15}
end tell
BTW, if you want to click at a specific location within Google Chrome, you can try the following:
set clickOffset to {100, 100} -- user set as desired
tell application "System Events"
tell process "Google Chrome"
set frontmost to true -- assumes Chrome already running
delay 0.5 -- or use repeat loop
set thePosition to position of window 1
end tell
click at {(item 1 of clickOffset) + (item 1 of thePosition), (item 2 of clickOffset) + (item 2 of thePosition)}
end tell
click at has unfortunately been unreliable for some time.
You can use the very useful command-line utility cliclick (i.e. CLI-Click) from AppleScript to accomplish this reliably. It’s available on Homebrew.
to clickAt(global_coordinates)
set coordinates_s to "=" & ((item 1 of global_coordinates) div 1 as string) & ",=" & ((item 2 of global_coordinates) div 1 as string)
GL's doShellScript(quoted form of CLICLICK_PATH & " c:" & coordinates_s)
return global_coordinates
end clickAt
Just make sure you replace CLICLICK_PATH with the path to the binary.