Measure Multiple Line Segments with an AutoHotkey On-Screen Ruler

Taking the MouseMeasure.ahk Script to the Next Level, We Add Multiple Calculations for Going Around Corners

The original MouseMeasure.ahk script captures a single-length in a straight line—as a crow flies. While this works great for many applications, roads and highways generally wind over travel distances. Depending upon where you’re going, this can cause a significant variation in the total calculation. To return a more accurate overall estimate, we must break the measurement line into shorter segments.

Start the measurement with the Ctrl+LButton Hotkey, then click the left mouse button for each new leg of the journey. Press the Shift key to terminate the last leg and display the total distance.

The original form of the MouseMeasure.ahk script only allows for a sole straight line. To add more legs to our journey (at different angles), we must implement AutoHotkey techniques for:

  1. Terminating one segment and starting a new one.
  2. Tracking the position of each segment, its length, and the total distance traveled.
  3. Refreshing the screen to include all past legs as well as the new leg.
  4. Sending multiple saved data items for each leg to documents and forms.
Continue reading

Drawing Lines on Screens with AutoHotkey (Graphics Tips)

Although a Little Tricky, You Can Add and Manipulate Windows Graphics on Your Computer Screen with AutoHotkey

In the blog “Capturing Computer Screen Measurements (An AutoHotkey Tool)“, I added a calibration method to an on-screen ruler for extracting distances from any image. It works well for capturing straight-line measurement from a computer display. However, when following the mouse cursor, it lacked a discernible tracking line between the start and stop points.

The green line anchors at the start point and moves with the mouse cursor.

With a search, I found an old post about how to generate a line on-screen. I copied the code and turned it into a function for displaying the green line shown in the image above.

Continue reading

Quick and Dirty Multi-Line Text Formatting (AutoHotkey Tip)

Formatting Text for Various AutoHotkey Tools Can Get Tedious—Use AutoHotkey Section Continuation to Simplify the Work

In the MouseMeasure.ahk script (discussed last time), I added a pop-up window displaying instructions on how to use the app. I formatted the text with a number of new lines and tabs. Usually, this would have required careful placement of the special escape characters, but not this time.

When adding instructions to a MsgBox, we often resort to adding returns (`r), newlines (`n), and tabs (`t) to create the desired layout. While this works, it often produces perverse effects—especially when using individual line continuation techniques to wrap the code for display purposes. However, AutoHotkey offers an alternative type of code continuation which makes text formatting quick and easy— continuation sections (Method #2).

Continue reading

Capturing Computer Screen Measurements (An AutoHotkey Tool)

Calibrate the MouseMeasure AutoHotkey Tool to Grab Calculated Lengths from Your Computer Monitor

Recently, a reader asked, “Do you think it is conceivable to create a screen ruler in AHK that can be calibrated to my native application ruler. The problem I have now is that I take tons of measurements off the screen and then I have to type that number back into a document. I would love to make a ruler that can basically calibrate with the native app ruler once and make the data from the AHK ruler transfer automatically to the clipboard or better yet straight to the document.”

I responded, “The application you’re looking at is quite conceivable. You can pick coordinates off the screen with the MouseGetPos command and save them. Then you can possibly use two clicks to calculate the difference between the two in pixels then convert it to your scale. There are a number of methods for sending data to documents. It is certainly within the realm of possibilities.”

I then searched the AutoHotkey board only to find that he had already posted the same Ruler question in the “Ask for Help” forum. Fortunately, AutoHotkey Forum user colt had already posted a response. With the heart of the work completed by colt, I decided to add an onscreen calibration method.

Pythagorean Theorem

Pythagoras gave every high school math student a reason to remember his name. He provided the method for calculating the hypotenuse of a right triangle. For most people, the formula fell into the toolbox of things-I’ll-never-do-again. But for anyone who wants to measure distances on a computer screen, the Pythagorean Theorem returns with a vengeance.

Continue reading

AutoHotkey Tip of the Week: Alternative AutoHotkey Notices

In Addition to the ToolTip Command, AutoHotkey Offers Other Useful—Although Less Flexible—Message Commands

In my last blog, I suggested several different ways to use the ToolTip command. This time I take a quick look at a couple of other methods for passing information to users. While less flexible than the many of the other informational techniques, the Menu, Tray, Tip command and the TrayTip command each serve a useful purpose:

  1. System Tray Icon ToolTip for adding information about individual running AutoHotkey scripts.
  2. Alternative TrayTip Command for brief Windows notices about script activity.

Depending upon the situation, you may find either of these techniques a useful alternative to ToolTips, SplashText, SplashImages, Progress bars, or the Message Box.

Continue reading

AutoHotkey Tip of the Week: ToolTip Command Tricks

See What You Can Do with the AutoHotkey ToolTip Pop-up!

AutoHotkey AutoHotkey Library Deal!

The ToolTip command acts as a conduit for communication between an AutoHotkey script and its user. Similar in function to other visual information tools (the SplashText command, discussed in a previous blog,  and the Progress/SplashImage command used in the InstantHotstring.ahk script), the more compact ToolTip follows the mouse cursor by default, rather than planting itself in the middle of the screen. You can use the tiny pop-up window in several different ways:

  1. Action Complete ToolTip
  2. Toggle Status Tooltip
  3. Reminder ToolTip
  4. Realtime Informational ToolTip
  5. Instructional ToolTip
  6. Multiple ToolTips
Continue reading

AutoHotkey Tip of the Week: Channeling Text to a Tagged Window

When Collecting Information from Various Sources, Send the Text Directly to an Unseen Text Editing Field

Last time in “Tricks for Tracking and Activating Target Process Windows“, I demonstrated a technique for tagging and tracking a window using its Unique ID. After tagging any window with one Hotkey combination, you can instantly recall it with another. While a pretty cool trick, the question of when would you ever use it arises. This time I offer a practical tool for gathering information from various digital sources (Web pages, documents, e-books, etc.) into one text editor window—without jumping back-and-forth while doing cut-and-paste operations. Continue reading

AutoHotkey Tip of the Week: Use ToolTips to Make Apps User-Friendly—August 26, 2019

Tip: By Applying the OnMessage() Function, You Can Include Windows ToolTip Notes in Your AutoHotkey GUI Window Scripts to Add Hints and/or Instructions Which Pop-up When Mousing-Over the Controls

Light Bulb!People might find some cleverly-designed AutoHotkey scripts confusing. Wouldn’t you like to add hints and tips which explain each control in your AutoHotkey GUI window? You can do just that with the ToolTip command and the OnMessage() function.

coverepub-250In the book AutoHotkey Applications, “Chapter Thirty-four: Pop-up Labels for All Your Programs (ToolTip Command)”, the Tooltip command highlights each control in an AutoHotkey GUI (Graphical User Interface) window. Use the ToolTip command to add helpful little informational notes to your AutoHotkey applications. Once you implement this tip, whenever you hover the mouse cursor over controls in an AutoHotkey GUI, the ToolTip command will identify the control’s function or give instant instructions (as shown below).

(Extra Tip: You can use this same technique with other non-AutoHotkey Windows application by identifying window and control names with Windows Spy or the WindowProbe.ahk script, then writing a short companion AutoHotkey script to work with the Windows program.)

ToolTipHelp
An AutoHotkey GUI shows three different ToolTips as the cursor is moved over each control.

Continue reading

Recognize Running Scripts with System Tray Icon Techniques (AutoHotkey Tip)

If You Run a Number of AutoHotkey Scripts Simultaneously, Distinguish Each Icon in the Windows System Tray with These Menu Commands

At times, I’ve found that I have six or more AutoHotkey scripts running at the same time. Each one adds the little green icon with an embedded “H” to the Windows System Tray. This gets confusing. I can only tell them apart by hovering the mouse cursor over an icon and reading the script name in the Tooltip pop-up message. Sometimes the Tooltip alone doesn’t do an adequate job. Continue reading

Turn AutoHotkey System Tray Icons into One-Click Action Buttons (AutoHotkey Tip)

Rather Than Using Hotkey Combinations, a Simple Click of the Icon in the Windows System Tray Launches Your App

One of the features I added to the InstantHotkeyArrays.ahk script turns the Windows System Tray AutoHotkey into a one-click button for launching new Instant Hotkeys. The new hot-button made from an existing icon works out well—especially since I can never remember the Hotkey combination for creating a new Instant Hotkey. Continue reading