dowload https://github.com/BlueM/cliclick
unzip cliclick-master.zip
in a Terminal
cd /Users/yourname/Downloads/cliclick-master
make
now you have in /Users/yourname/Downloads/cliclick-master/
cliclick , command tool for using a mouse in applescript with do shell script
copy cliclick in /usr/local/bin folder
in a Terminal
cp -f /Users/yourname/Downloads/cliclick-master/cliclick /usr/local/bin/
in applescript for example
do shell script "/usr/local/bin/cliclick " & quoted form of "c:12,34"
will click at the point with x coordinate
12 and y coordinate 34.
in a Terminal for LIST OF COMMANDS
cliclick -h
other way in Applescript
set x to 30
set y to 5
set l to 50 -- click same location 50 times
do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
for x in range(0, " & l & "):
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END
"