Mac – How to automate mouse movement in OS X via AppleScript or a shell script

applescriptmacmacrosmouseshell

Just recently I got into an FPS game and I've wanted to challenge myself to make an anti-recoil script for a while.

An anti-recoil script would essentially move the mouse based on a set of calculations or a fixed pattern.

So far I've tried moving the mouse via Automator and Keyboard Maestro, but for some reason when the mouse is moved via these programs, everything except the game recognizes it, and so instead of the game's camera view moving, the actual cursor becomes visible overtop the game and moves to a different point on the screen. Essentially the cursor is teleporting from point to point and the game doesn't recognize it.

I was wondering if there is an alternative way to move the mouse via AppleScript or shell script?

Best Answer

I use cliclick All the time. Works great for everything I need it for

Here is a screen shot some of the commands

enter image description here

Related Question