

You can find your keyboard event number using sudo evtest then find the key names using sudo evtest /dev/input/eventXXX using the event number. With this code you also need to run xbindkeys as sudo xbindkeys -f ~/.xbindkeysrc # get evtest return code, if it's 0 the key is up # this is why you need to use sudo/superuserĮvtest -query /dev/input/$kbd EV_KEY $key With infinite_clicks.sh being: #!/bin/bashĮcho "Usage: $fn input_device key_name delay"Įcho "Example: $fn event16 KEY_SCROLLLOCK 0.1"

"/home/USER/infinite_clicks.sh event16 KEY_SCROLLLOCK 0.1 &" Method 1, in ~/.xbindkeysrc: keystate_scrolllock = enable Once you have all your positions noted down where you wish to perform the mouse clicks, it's now time to set it up. Please note, you may have to perform this steps for more times to get the mouse pixels, as in where you want your mouse cursor to go and click. It seems to have some problems with certain key combinations, not sure what was causing it however. In above command you are simply getting cursor X & Y Position. The first is decent if you don't need to change the delay. repeat 3 times - Enter Your Desired Loop Countĭo shell script "/usr/local/bin/cliclick c.Here's my first and fifth attempts. The Autosofted Auto Keyboard Presser and Recorder is a fully hotkey compatible tool, it is also very simple to use. This AppleScript code works for me using the latest version of macOS Mojave. A simple to use auto keyboard presser to automate keyboard presses. For example: do shell script "/usr/local/bin/cliclick c." In AppleScript it's telling cliclick to click at current mouse location. Because of this location, in my AppleScript code and in Terminal app, I need to use the full path to cliclick to call the command. cliclick in the following directory: /usr/local/bin/.

It's free to download but it's donationware, and is easy to install.

Moreover, it lets you move the mouse, get the current mouse coordinates, press modifier keys etc. It is a a tiny shell/Terminal application that will emulate mouse clicks or series of mouse clicks (including doubleclicks and control-clicks) at arbitrary screen coordinates. “Cliclick” is short for “ Command- Line Interface Click”. This code requires the third-party utility, Cliclick.
