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

Share:
19,564
BuddyJoe
Author by

BuddyJoe

I like to code C# and work with the web. Still learning.

Updated on June 04, 2022

Comments

  • BuddyJoe
    BuddyJoe almost 2 years

    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
    BuddyJoe about 15 years
    is 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
    BuddyJoe about 15 years
    This is awesome. Had to post to the AHK Forums to get the correct syntax. see: autohotkey.com/forum/viewtopic.php?t=41375
  • BuddyJoe
    BuddyJoe about 15 years
    If you compile the scripts to executables, does that mean you can distribute "your" AHKs to someone who doesn't have AHK installed?
  • John T
    John T about 15 years
    yes, 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
    AFOC over 2 years
    This 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 (press 5 to stop holding), * switches to right click, / switches back