Windows - Map a Keyboard Key to the Same Action as Left Mouse Button
19,564
Solution 1
There is a programmatic way, and it is possible in C# with a global hook. But I find tools like AutoHotkey, which were made for this sort of thing, are much quicker to get up and running. The scripts can also be compiled to executables.
Solution 2
You could also turn on Accessibility MouseKeys via the Accessibility Options

Author by
BuddyJoe
I like to code C# and work with the web. Still learning.
Updated on June 04, 2022Comments
-
BuddyJoe 12 months
Is the a programmatic way (or something more simple) to map some keyboard key to the same action windows-wide as the left mouse button in Windows XP / Vista. If programmatic is there a way to do this in .NET 2.0 (or greater)?
-
BuddyJoe over 14 yearsis it me? I turned this ON on Windows Vista and couldn't figure out how to make it do anything different. with the num lock on and off.
-
BuddyJoe over 14 yearsThis is awesome. Had to post to the AHK Forums to get the correct syntax. see: autohotkey.com/forum/viewtopic.php?t=41375
-
BuddyJoe over 14 yearsIf you compile the scripts to executables, does that mean you can distribute "your" AHKs to someone who doesn't have AHK installed?
-
John T over 14 yearsyes, that's exactly what the compiler's for. From the front page - "Convert any script into an EXE file that can be run on computers that don't have AutoHotkey installed."
-
AFOC almost 2 yearsThis is the best option, it's built in, intended for this very thing and works great. Once it is activated,
ALT + SHIFT + NUMLOCK
turns it on & off,5
is left click,0
is hold left (press5
to stop holding),*
switches to right click,/
switches back