Track Graphic Line Measurement Segments Using AutoHotkey Arrays

When Refreshing the MouseMeasure.ahk Invisible GUI Graphics Layer, AutoHotkey Uses a Simple Array of Associative Arrays to Track the Data

In my last blog (“Measure Multiple Line Segments with an AutoHotkey On-Screen Ruler“), I introduced multi-segment lines for estimating distances of non-linear routes. When refreshing the graphics to animate the moving line, all previously fixed segments need redrawing. Objects-based arrays provide the best method for tracking and regenerating these lines.

Each leg of the journey corresponds to a simple array element containing an associative array of data. The white box displays the key:value data saved in MyArray[4].

The difference between pseudo-arrays, simple arrays, and associative arrays can get confusing. For the novice AutoHotkey scriptwriter, unfamiliar Object-Oriented Programming (OOP) notation can make understanding the code even more difficult—especially if you attempt to learn OOP from online documentation.

You may think you need to choose between the traditional AutoHotkey syntax and OOP coding, but you don’t! AutoHotkey allows you to mix-and-match most OOP and classic AutoHotkey syntax—as long as you understand how they integrate.

Continue reading

Replace Hotkeys with the AutoHotkey GetKeyState() Function

While Digging into On-Screen Graphic Line Generation, I Discovered a Number of New AutoHotkey Techniques to Add to the MouseMeasure.ahk Distance Capturing Script

Last time, I looked into adding a line drawn on-screen to visually represent a linear measurement (“Drawing Lines on Screens with AutoHotkey“). However, I didn’t feel that the drivers I used presented the result I wanted for the MouseMeasure.ahk script. The line jittered too erratically and I found holding down the left-mouse button while dragging awkward and lacking precision. Therefore, I didn’t post the final product—although I did provide a download for the curious.

I have since drawn upon the expertise of other AutoHotkey Forum users to revise the script and create a much more robust app. The new script includes the following improvements:

  1. Only one Hotkey combination (Ctrl+LButton) activates both the calibration and measuring subroutine.
  2. The script no longer requires holding down the left mouse button while positioning the end point of the measurement. The end-point remains attached to the moving mouse cursor.
  3. The more advanced GDIPlus graphics used to draw the line make the line smoother and more robust.

The MouseMeasure.ahk script now uses Windows GDIPlus graphics to draw a red line between the start and end points of the on-screen ruler. The end point of the line moves with the mouse cursor until pinned with either the Shift or Alt key.

I pulled these improvements from a number of sources.

Continue reading

AutoHotkey Tip of the Week: Embed Images Directly in the AHK Script

Rather than Use the FileInstall AutoHotkey Command, This Trick Allows You to Lodge Images Directly into Your AutoHotkey Scripts

Light Bulb!In the past, whenever I wanted to add a graphic image to an AutoHotkey script, I needed to either separately provided the file or embed it in the compiled EXE file using the FileInstall command. The AutoHotkey world has opened my eyes to an ancient technique for embedding an image directly in the AHK script—no need to supply the file separately or embed it by compiling the script. Continue reading

Quick Fix for Inserting Color Data into Windows Paint (AutoHotkey Tip)

Auto-Fill Windows Program Data Fields Using RegEx—Plus, Alternative for Pop-up Messages

While the Coloretta Viva script copies pixel colors, transferring codes to Windows Paint gets awkward. This AutoHotkey data filling technique for multiple fields works in any Windows program. Plus, we look at another method for popping up user messages.

I recently highlighted the AutoHotkey Coloretta Viva color picking app at ComputorEdge Software Showcase. As a color matching tool, I consider the script an excellent start. However, I offer a couple of observations. Continue reading

Why AutoHotkey for Artists and Graphic Designers?

While Using AutoHotkey with Windows Makes Sense for Most Professions, It’s Not So Obvious for Artists and Graphic Designers

If you work in the graphic arts on computers, then you know that a multitude of programs exists for creating designs and original art pieces. Each one works a little differently with artistcartoonspecific strengths and weaknesses. You may even use a couple of particular software packages for certain projects. Wouldn’t it be nice to own a few tools which work in every one of those programs?

When producing ads and capturing screenshots, even I use a number of disparate apps for designing and finishing the artwork. (I have a preference for the free Paint.Net program.) However, no matter how powerful and feature-filled the software, I always want the tools to do a little more while working in each program. That’s where AutoHotkey comes in. Continue reading

New Hotkey Book! (AutoHotkey Tips and Tricks)

AutoHotkey Techniques and Best Practices E-Book for Automating Your Windows Computers with Hotkey Combinations—Includes Something for Everyone!

Whether you’re a noobie to AutoHotkey scripts or an advanced programmer, of all my books, AutoHotkey Hotkeys may be the most important for new little-known tricks and useful ideas. It’s not that the other books don’t cover significant features of AutoHotkey, but this book includes some of the most practical tips for adding power to your scripts. I didn’t plan it that way. Continue reading

AutoHotkey Script for Precision Hotkey Mouse Movement in Windows Graphics Programs—Continued (Beginning Hotkeys Part 16)

This Short AutoHotkey App Adds Pixel Level Precision to Mouse Cursor Movement in Any Windows Graphics Program.

This time we add more cursor directions by implementing numeric keypad Hotkey Scan Codes, plus a feature for temporarily adding these micro cursor hotkeys to any new graphics app.

Continue reading

AutoHotkey Script for Precision Hotkey Mouse Movement in Windows Graphics Programs (Beginning Hotkeys Part 15)

This Short AutoHotkey App Adds Pixel Level Precision to Mouse Cursor Movement in Any Windows Graphics Program. Plus, Best Practices When Creating Hotkeys and More.

From time to time I use various Windows graphics programs. I regularly open 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. However, there is one annoying factor when working with virtually any graphics software. Using a mouse for selection and alignment tends to be inaccurate and sloppy. It’s very difficult to move the mouse cursor with pixel level exactness—at least not without massively magnifying the image size.

Continue reading