This Little Program Adds Pixel Level Precision to Mouse Cursor Movement in Any Windows Graphics Program
In my journey with AutoHotkey, I’ve written numerous scripts for various purposes—mostly with educational objectives. Only a select few end up in my Windows toolbox. I highlight this next tiny program because I use it regularly. When I first wrote it, the script acted as a demonstration for how to use AutoHotkey to remap your keyboard for special purposes. This convenient gadget works so well for graphics applications that I’ve added it to my most-useful-tools folder. The little piece of software I call MousePrecise converts the numeric keypad into an accurate mouse cursor movement control.
Note: Even though I wrote the app in AutoHotkey, you don’t need to know anything about the free scripting language to use MousePrecise. I’ve compiled the script into an EXE file which runs directly on any Windows computer with a simple double-click of the filename. (Find the compiled MousePrecise app as MousePrecise.exe in the ZIP file available for download at the ComputorEdge Free AutoHotkey Scripts page. Depending upon your Windows settings, you may get warnings, but rest assured, as long as you download it from the ComputorEdge.com site, the program is safe.) If you feel some curiosity about AutoHotkey, see this “Introduction to AutoHotkey: A Review and Guide for Beginners.”
Not everyone needs MousePrecise—only people who occasionally load graphics or photo editing programs…or, maybe, people who crop sections of an image or Web page. If you regularly create visual Internet memes, then you might find this utility valuable. Or, if you have trouble maintaining the mouse positioned over a particular pixel while clicking the left mouse button, then this app could become your best friend.
From time to time, I use various Windows graphics programs. I regularly open the free Irfanview as my default image reader and occasionally use the built-in Windows Snipping Tool for screen capture. But my favorite graphics program is the free Paint.Net image and photo editing software for PCs. I usually design Web ads and cleanup embedded images with Paint.Net.
Nonetheless, when working with virtually any graphics software, I find selecting an exact point on an image with the mouse cursor—then clicking the left mouse button—a challenge.
The pixel-slip problem occurs with the slightest movement of the mouse (or when pressing and releasing the left mouse button) causing the cursor to jump one or two pixels in any random direction. Whenever, while holding the left button down, I attempt to locate the mouse cursor with pixel accuracy, I either miss the mark or my finger accidentally slips and/or releases the button. Most graphics programs do allow limited use of the cursor keys for the incremental relocation of certain objects and selections, but it’s not universal and often limited to only one or two tools. Pixel level preciseness provided via the arrow keys comes in handy anytime you would normally hold down the left mouse button while dragging the cursor across an image—whether drawing an object, moving a selection or aligning parts of an image.
The MousePrecise app offers pixel-level precision by creating a set of Hotkeys which move the mouse cursor one pixel at a time in any of eight directions while (when selected) simultaneously holding down (hands-free) the left mouse button. As a convenience for large movements, the mouse, when moved manually, continues to operate normally (while keeping the left mouse button pressed down), but, when looking for extreme accuracy prior to programmatically releasing the left mouse button, the numeric keypad keys increment the mouse cursor pixel-by-pixel.
The beauty of this app rests with the fact that it works in any Windows program which uses the left mouse click-and-drag maneuver—that includes almost all of them. Plus, you can temporarily add the MousePrecise capabilities to any Windows graphics app with a right-click of the mouse—without interfering with other running programs.
Use the Numeric Keypad for Exact Mouse Cursor Location
The image above needs almost no explanation. After loading the app, the numeric keys move the mouse cursor in the directions shown (as seen in the image above). Hit the number pad zero key and the app presses and holds down the left mouse button. After moving the mouse—either manually or with the number pad keys—hit the number pad key again to release the left mouse button.
The MousePrecise utility uses the arrow keys to move the mouse cursor one pixel at a time—either Up, Down, Left, Right, or at the 45° angles in between—in designated Windows graphics programs. By using the number pad zero key as a Hotkey up/down toggle for holding the left mouse button, you can precisely drag (left mouse button down) the mouse cursor pixel-by-pixel in any Windows graphics program.
Initially, MousePrecise only operates in a few loaded programs: Windows Paint, Windows Snipping Tool, and Irfanview graphics viewer. However, you can temporarily add (until a reload or reboot) the capability to any Windows program with a click of a button.
MousePrecise Isolated to Specific Programs
While you may want many of your AutoHotkey Hotkeys universally available at all times (e.g. launching Windows apps, opening Web sites), MousePrecise isolates its Hotkey function to only those programs where you need them. For example, while ideal for graphics programs (e.g. photo and image editors), this app serves a limited purpose in most other programs (e.g. word processors and Web Browsers). By isolating Hotkeys to specific Windows programs, the new key combinations don’t affect other programs or Windows in general. This decreases the odds of an inadvertent Hotkey conflict.
When first loaded, these Hotkeys only operate for a Windows Paint window, the Windows Snipping Tool, and the free IfranView graphics viewer and editor. All other open apps and the Windows system itself remain unaffected. You can add the MousePrecise features to more programs by either temporarily including more programs or (if you want to do a little AutoHotkey scripting) by writing your favorite programs into the script.
To understand and/or modify the MousePrecise.ahk script, see the blogs “AutoHotkey Script for Precision Hotkey Mouse Movement in Windows Graphics Programs” and “AutoHotkey Script for Precision Hotkey Mouse Movement in Windows Graphics Programs (continued).”
Temporary Add Hotkeys to Another Program
Since users may want to quickly add this tool to their favorite program, I’ve included two methods for activating the Hotkeys in any active (selected and on top) window. Either right-click on the MousePrecise icon in the System Tray and select Add Window Class (as shown at left) or press the CTRL+Delete key combination on the numeric keypad.
After temporarily adding a new program, MousePrecise pops-up a message box confirming the inclusion of the MousePrecise Hotkeys in the new program by name (as shown at left). After that, the numeric keypad cursor keys should work whenever you activate that program window (or open a new window with the same program) until you either exit MousePrecise, reload MousePrecise, or reboot your computer.
Pop-up Showing State of Left Mouse Button
Since activating number pad zero in MousePrecise holds down the left mouse button indefinitely without adding any strain to your index finger, there exists the possibility that you might forget the current state of the left mouse button. Therefore, I added a pop-up window in the corner of the window which tells you its position. As long as MousePrecise holds down the left mouse button, the app ignores any future clicks.
At times, when in the middle of a MousePrecise left mouse down procedure, I’ve found myself distracted by other Windows activities. When I get lost and confused by the unresponsive mouse, I need to reset.
You’ll find two options for resuming normal left mouse button clicking:
- Press zero on the numeric keypad to release the left mouse button.
- Press the Enter key on the numeric keypad to cancel the current state of MousePrecise.
When I originally wrote this little program, I had no idea how much I would come to love it. I use it all the time!
This post was proofread by Grammarly
(Any other mistakes are all mine.)
(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)