Assign left mouse click to a keyboard key
Solution 1
You should be able to achieve this using BetterTouchTool. It's an app you'd have to install but it's free an has lots of other useful features. You can also choose to limit this functionality to a single application or use it globally.
Solution 2
You can use OS X's Mouse Keys feature to use the keyboard to click the mouse. (It's an accessibility feature.) You can enable a keyboard shortcut to turn it on and off if you don't want to use the feature all the time.
With Mouse Keys, just use the number 5 (or the equivalent letter key I) to click. Pressing 0 or M will work for holding down the mouse button, and period will release.
https://support.apple.com/en-us/HT204434#mousekeys
Related videos on Youtube
zadam
Updated on September 18, 2022Comments
-
zadam over 1 year
I would like to be able to assign a key on my keyboard to be equivalent to a left mouse click.
Ideally it needs to act such that holding the key down is also equivalent to holding the left mouse button down.
How can I do this?
-
Admin almost 13 yearsI'm almost positive you need to buy a new mouse. =P
-
Admin almost 13 yearsOS X has limited options for simulating mouse clicks (applescript falls short in this department), but this might help you with the mouse click part: hints.macworld.com/article.php?story=2008051406323031 --- After you edit it to your needs and compile, you'll need to bind that app to a hotkey in order to have a key press activate it, you can try something like Spark for that: macupdate.com/app/mac/14352/spark -- not sure about the holding the key down though
-
Admin almost 13 yearsIn your Stack Overflow duplicate, you said you could also use a programmatic solution using AppleScript or Cocoa. Why not here?
-
Admin almost 13 yearsslhck - I didn't mention programmatic solution here because I was treating SuperUser as a user focused site. To be clear though - I am happy with a programmatic solution!
-
-
slhck almost 13 yearsYes, it's possible. In "Preferences" - "Keyboard" - "Add new shortcut", and in actions, select "leftclick".
-
zadam almost 13 yearsslhck - I couldn't get this to work