Use Alternative Filename Extensions for Special Format Files (Part Five: Finishing AutoHotkey GUI Scripts)

While Changing the Saved Filename Extension in the InstantHotstring.ahk Script Helps Protect Original AutoHotkey Files, the Technique Offers Additional Benefits…Plus, a No-Wait Progress Bar for Instant-Saves

Over the course of the past few blogs, I added protection to files containing AutoHotkey code by both including a one-line file header and changing the saved filename extension to .hsf. These steps have resolved my concern about overwriting any AutoHotkey scripts—from which I may have extracted Hotstrings and loaded them into the “under-construction” InstantHotstringMenuBar.ahk app. At times, I thought that adding the two techniques might be overkill but now I’ve come to realize that using an alternative extension provides benefits that may prove even more useful than my initial attempt at protecting .ahk files.

Continue reading

Sensing AutoHotkey Editing Changes for Instant Save (Part Three: Finishing AutoHotkey GUI Scripts)

By Detecting Modifications in Edit Data We Know When to Activate Instant-Save Routines

Any change too active Hotstrings appends an asterisk (*) to the current open filename and enables the Save option.

In the last blog (“GUI Menu Bar “Save” Item Complications (Part Two: Finishing AutoHotkey GUI Scripts)“), I discussed the need to add a special header to a unique type of data file—InstantHotstring generated Hotstrings. This header helps to differentiate between AutoHotkey .ahk files—which you may not want to overwrite—and files generated by the InstantHotstring.ahk script.

When adding a Save option (instant-save using the CTRL+S key combination) to the menu bar, many Windows apps concatenate an asterisk (*) to the file name in the title bar—alerting the user to changes. In this blog, I add a similar change-detecting feature which both displays the appended asterisk and enables an instant-save routine.

Continue reading

Auto-Install Data and Text Files Embedded in .AHK Scripts (AutoHotkey Tip)

While the AutoHotkey FileInstall Command Works Great When Packaging External Files inside Compiled EXE Files, You Can Also Package and Extract Data and Text Files with Uncompiled AHK Script Files

coverepub-250In Chapter Six and Chapter Thirty-eight of the book AutoHotkey Applications, I discuss using the FileInstall command when combining various types of support files (e.g. jpg, wav, ini) into one compiled EXE file. Upon loading the app for the first time, a double-click of the left mouse button extracts the embedded files and places each at its proper location on the drive. After downloading an AutoHotkey app, this command alleviates the need to keep track of each external file required by the package. However, the FileInstall command only works for compiled EXE files.

Due to the ever-present risk from computer viruses, it gets harder and harder to send and download EXE files. Both Web and computer security systems give user warnings—if they don’t outright block all EXE files. The safest and easiest way to share AutoHotkey apps is through the text-based .ahk script files which contain only human-readable code. (Users can later compile the script themselves.) If you want to include more files than merely the AutoHotkey script, you can package all the pieces inside a ZIP file for later unzipping. But, if you want to include a text-based data or ReadMe.txt file for the AutoHotkey app which automatically extracts into the working folder, then you can use the following technique—no FileInstall command required.

Continue reading

Fixed the InstantHotstring.ahk Script Slow Hotstring Loading Problem

New Version of InstantHotstring.ahk Script Now Available!

I’ve rewritten the LoadHotstrings subroutine in the InstantHotstring.ahk script (alternate download) to overcome the slowdown created by using the pre-existing routines found in the original script, “AutoHotkey Script Speed Problems (Scripting Insights).” I simplified things by limiting the subroutine to:

  1. Adding Hotstrings directly from the file without extra processing—no interaction with the DropDownList GUI control.)
  2. Checking for duplicated or changed Hotstrings within a single variable.
  3. Activating each Hotstring as its added.

AutoHotkey exports the DropDownList GUI control contents just once into a single variable and only writes the new DropDownList after processing the entire target file. The test file of over 1000 Hotstrings loads in one to two seconds—depending upon the weather. (The old routine could take up to 70 seconds for that same file.)

You can find the new code (InstantHotstring(FastLoad).ahk) and the old code (InstantHotstring(SlowLoad).ahk) at the InstantHotstring.ahk section of the ComputorEdge Free AutoHotkey Scripts page.

I’m currently working on blogs which discuss both the philosophical and technical aspect of rewriting the subroutine.

Click the Follow button at the top of the sidebar on the right of this page for e-mail notification of new blogs. (If you’re reading this on a tablet or your phone, then you must scroll all the way to the end of the blog—pass any comments—to find the Follow button.)

jack

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.)

Loading Hotstrings into the InstantHotstring.ahk Script from Any AutoHotkey (.ahk) File

Reading Data from Saved .AHK Files Makes Loading Hotstrings into the InstantHotstring.ahk Script Easy

In the blog, “Use the FileSelectFile Command to Save Instant Hotstrings to an AutoHotkey File.” I discussed how to save a set of newly created InstantHotstring.ahk Hotstrings in .ahk files. The other half of the file storage problem involves reading those saved (or any other) Hotstring data files back into that same app. Using the tools already built into the script made writing the file loading code remarkably easy. The subroutine LoadHotstrings calls on the previously written subroutines SetOptions and AddHotstring. This saves replicating of code originally used in those subroutines.

Continue reading

Updating the INI Data Table File (AutoHotkey Legal ListView Part 4)

While It Only Takes One Line of Code to Update the INI Data File, You Must Take Into Account the INI File’s Encoding. Plus, DIY Implementation of the Other Cool ListView Features

Last time, I added code to the LegalListView.ahk script to edit and update the ListView window. This time, I add one line of code to update the same data in the LegalListView.ini file.

By updating the data table file with the edits made via LegalListView.ahk, we save any changes for future use. Continue reading

Editing ListView GUI Control Data Tables (AutoHotkey Legal ListView Part 3)

Once Loaded into an AutoHotkey GUI ListView, You Can Add Tools for Editing Data

With the exception of the first column, AutoHotkey does not allow direct editing in a GUI ListView control. That forces us to create separate editing controls for changing and updating content in any of the other columns. We can either add the controls to the same GUI as in the AddressBook.ahk script (shown below)—discussed in my AutoHotkey Applications e-book—or we can create a second GUI which pops-up on demand. Since putting all the controls in the same GUI creates less confusion for the ListView functions (the functions always operate on the default GUI), you might find the AddressBook.ahk example easier to implement for your application. Continue reading

Use the ListView GUI Control to Find Duplicate Entries in Data Table Files (AutoHotkey Legal ListView Part 2)

ListView Control Functions in a Loop Work Quickly Locate Repetitious Data

In my last blog, “ListView GUI Control for Viewing Data Table Files (AutoHotkey Legal ListView Part 1)“, I introduced using the ListView GUI control to view and correct a data table file—in this case, an INI file (LegalInput.ini). While sorting and viewing a data table in the ListView control offers many benefits, the most power comes from the 11 built-in functions available for manipulating the control and editing data.

All GUI controls (e.g. Edit, Text, MonthCal, etc.) offer options you can call with the initial Gui, Add command. ListView (and its sister TreeView) include similar options plus special functions for directly manipulating the control. Last time, we used LV_Add() to load the data table rows into the ListView control. This time, we use the LV_GetCount() function (the number of ListView rows) to limit the total number of iterations in a loop, LV_Modify() to focus on each table row in sequential order, and LV_GetText() to retrieve and store data in the row. Continue reading

ListView GUI Control for Viewing Data Table Files (AutoHotkey Legal ListView Part 1)

The Powerful ListView GUI (Graphical User Interface) Control Offers Advanced Features for Reading and Sorting Data Tables, Plus How to Make a ListView GUI Control Resizable

Recently, I wrote about how to use a data table to create Hotstrings using the Input command, then, after discovering that I can’t remember all the Hotstring combinations, showed how to build lookup menus from the same data table. Later, I used the same menu technique to demonstrate how to insert Latin legal terms in italics. I made a promise to create a Legal Lingo ListView GUI (Graphical User Interface) pop-up but, before I could undertake the task, other topics intervened. The time has come for me to deliver on my commitment. Continue reading

Put Your Emoji Hotstrings in a Pop-up Menu (AutoHotkey Trick)

Unless Endowed with a Photographic 📷 Memory, Who Can Memorize All the Activating Texts ✍ for Over 1000 Emoji 😀 Hotstrings? Use This Menu 🍱 Technique to Find and Insert Emojis 😀 Taken Directly from Your Hotstring Script

Who wouldn’t want all the emojis available at their fingertips? The last blog “Add Emoji Characters to Any Windows Document (AutoHotkey Hotstrings)” does just that. However, with the exception of the icons you use all the time, you won’t find remembering the activating strings easy. We need a quick lookup table to remind us of the activating strings for each image. Even better, why not a pop-up menu which both gives us the Hotstring keys and inserts the emoji? Fortunately, we can do this with a short AutoHotkey routine which searches the original EmojiInsert.ahk Hotstring file for our favorite characters.

Continue reading