
(More detailed explanation of how this toggle works follows in the next blog.) To simulate a mouse drag with the left button down, the Numpad0 key is set up as a toggling switch for holding the LButton Down, then on the next press LButton Up. It doesn’t get more precise than that! Next time, I plan to add a remapping of the numeric keypad allowing more movement directions (as shown in the image above). In the above script the arrow keys in combination with the ALT key ( !Up, !Down, !Left, and !Right) get mapped as Hotkeys with the MouseMove command repositioning the mouse one pixel at a time in each respective direction. !Right::MouseMove, 1, 0, 0, R Move cursor to the right !Left::MouseMove, -1, 0, 0, R Move cursor to the left !Down::MouseMove, 0, 1, 0, R Move cursor downward I start the script development with a modification of a barebones script I found online, then make a few improvements: !up::MouseMove, 0, -1, 0, R Move cursor upward Arrow Keys for Exact Mouse Cursor Location I’ve already found this script useful while breaking in the tool with the graphics in this blog.
AHK CLICK AND DRAG DOWNLOAD
While the final MousePrecise.ahk script does not appear in this blog, it is available for download at the ComputorEdge Free AutoHotkey Scripts page. It combines many of the AutoHotkey techniques discussed in previous blogs (and books) while offering a couple of Hotkey creation Best Practices and a few AutoHotkey tips and tricks. Reader’s Note: This series (which I suspect will be at least three blogs long) about the MousePrecise.ahk script takes you through the Hotkey script building process.
AHK CLICK AND DRAG WINDOWS
Plus, it works with any Windows graphic app you add to the script without interfering with programs where those Hotkeys would be deemed useless. The beauty of this script is that it works with any graphic tool that requires the left mouse click-and-drag maneuver-which happens to include almost all of them. As a convenience for large movements, the mouse continues to operate normally, but when looking for extreme accuracy before programmatically releasing the left mouse button, the arrow keys increment the mouse cursor pixel-by-pixel. The short AutoHotkey script I offer does just that by creating a set of Hotkeys which moves the mouse cursor one pixel at a time in the desired direction while holding down (hands-free) the left mouse button. Pressing the Numpad0 key toggles the left mouse button up and down for dragging. In the final MousePrecise.ahk script, movement of the mouse cursor one pixel at a time maps to the numeric keypad. Pixel level accuracy provided by the cursor keys comes in handy anytime you would normally hold down the left mouse button while dragging across an image-whether drawing an object, moving a selection, or aligning parts of an image. 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. Whenever I attempt to position the mouse cursor while holding the left button down, I either miss the mark or my finger accidentally slips and/or releases the button. The problem is that a pixel is so small that the slightest movement of the mouse while either pressing or releasing the left mouse button causes the cursor to jump one or two pixels in any random direction. New to AutoHotkey? See “ Introduction to AutoHotkey: A Review and Guide for Beginners.”

If you find any of the information too confusing, then reviewing earlier blogs may be worthwhile.

This beginning Hotkey blog builds upon the discussions in the previous parts. It’s very difficult to move the mouse cursor with pixel level exactness-at least not without massively magnifying the image size. Using a mouse for selection and alignment tends to be inaccurate and sloppy. However, there is one annoying factor when working with virtually any graphics software. I usually design Web ads and cleanup embedded images with Paint.Net.
AHK CLICK AND DRAG SOFTWARE
But my favorite graphics program is the free Paint.Net image and photo editing software for PCs. I regularly open Irfanview as my default image reader and occasionally use the built-in Windows Snipping Tool for screen capture. Plus, Best Practices When Creating Hotkeys and More.įrom time to time I use various Windows graphics programs. This Short AutoHotkey App Adds Pixel Level Precision to Mouse Cursor Movement in Any Windows Graphics Program.
