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

Advertisements

Searching Data Files and Other Scripting Ploys with Emojis (Secret AutoHotkey Tricks)

Who Knew That You Could Use Emojis in AutoHotkey Scripts Just Like Any Other Computer Character? More Emoji Magic! 😏

Emoji unicornAs I played around with the EmojiMenu.ahk script from my last blog, I tested highlighting an emoji as a search key. I inserted the unicorn emoji (🦄) into a document, highlighted it, then hit CTRL+ALT+E. To my pleasant surprise, it worked! As shown on the right, AutoHotkey searched the EmojiInsert.ahk Hotstring file, located the emoji character for a unicorn, then inserted it into the pop-up menu. (I added the ::!fantasy::🦄 Hotstring—which doesn’t appear in the original EmojiInsert.ahk Hotstring file—after posting the file.)

Continue reading

Waiting for Web Data to Download (AutoHotkey Quick Tip)

A Look at a Manufactured Looping Technique Using the Goto Command to Ensure the Download of Web Page Source Code in an AutoHotkey Script

EatCheeseBurgerCartoonI ran into a problem with the SynonymLookup.ahk script. On occasion, the menu would appear showing only the original bold and bulleted search term as its sole menu item. This occurred when the script finished processing before downloading the source code from the Thesaurus.com page. As often happens when working on the Internet, the Web connection took a little too long to perform its job.

A common headache with any AutoHotkey script which uses the Web, the time it takes to interact with a site and download its content profoundly fluctuates. In the case of the SynonymLookup.ahk script, I needed to ensure that the variable containing the Web page source code existed and contained text before continuing to parse the synonyms.

Continue reading

Use BoundFunc Object [Func.Bind()] to Pass GUI Control Data (An AutoHotkey GUI Revelation)

Added as a Special Feature to AutoHotkey V1.1, You Can Quickly Bind Unique Data to GUI Controls for Passing to Functions—It’s Even Easier in V2.0. Add This One to Your Bag of AutoHotkey Tricks!

Sometimes in my explorations, I come across an unexpected gem. I dig into many aspects AutoHotkey merely because they exist—having no idea how a technique might affect my scriptwriting. Whenever I uncover a feature that switches on a light, I must admit I get a little excited. Interestingly, if I had not been rummaging through AutoHotkey V2.0, I may not have ever understood the significances of this latest revelation for GUI pop-up windows in V1.1 scripts.

*          *          *

GraphicSoundsIn a GUI (Graphical User Interface) pop-up window, passing the right data to a gLabel subroutine (or function) from a GUI control can get complicated. A couple of the more common methods includes calling the Gui, Submit command to store control values or using a technique for capturing control information, such as the MouseGetPos command or the special gLabel alternative function:

 CtrlEvent(CtrlHwnd, GuiEvent, EventInfo, ErrLevel:="")

While I can usually find a way to solve the data passing problem, I often find the answer awkward. Continue reading

Comparing Today’s AutoHotkey Version 1.1 and the Future Version 2.0 (Part 5—Replacing V1.1 gLabels with V2.0 GuiControl.OnEvent())

AutoHotkey Version 2.0 Drops the GUI gLabel in Favor of the Object OnEvent() Function

In AutoHotkey V1.1, the primary method for adding action to GUI pop-up windows employs the gLabel inserted into a GUI control’s options. As AutoHotkey moves to object-oriented programming in V2.0, the Gui.OnEvent() function replaces gLabels.

Launch Window V2In AutoHotkey V2.0, each GUI control responds to different Gui Events. For example, with the Gui Button control, you can register OnEvent() functions for Click, DoubleClick, Focus, and LoseFocus, while the Edit control directly supports Change. You register each type of initiating action you use with the OnEvent() function. In fact, you must register an event before AutoHotkey will respond. Continue reading

Beginning Tips for Writing AutoHotkey Scripts

Exploring the Existential Mysteries of AutoHotkey Code and How It’s Often Misunderstood

AutoHotkeyInsightsI’ve just published my latest book, Beginning Tips for Writing AutoHotkey Script, which endeavors to clear up some of the mystery surrounding the way AutoHotkey works. You’ll find grasping how AutoHotkey processes AHK scripts a tremendous help. Quite a bit of the confusion encountered by novice AutoHotkey scriptwriters occurs through misunderstandings about the manner in which everything (life, the universe, and AutoHotkey scripts) fits together. I wrote the book with that muddiness in mind. Continue reading

Matching Instant Hotkeys with a Loop (AutoHotkey Tip)

Sometimes You’ll Find a Loop a Simpler Way to Match Things

ProgrammingRobot

“…stuck in an infinite loop. Like I just said, it’s so depressing to get stuck in an infinite loop. Like I just said, it’s…”

If you’re new to AutoHotkey with little or no scripting experience, then this blog may venture too far into the weeds. I don’t like to put off new users because the journey into Windows scripting is well worthwhile. Most find it easy to get started with AutoHotkey with many simple-to-implement tools. However, it takes a little time to understand the nuances of the more advanced techniques. I recommend that AutoHotkey noobies start with the basics such as found in the “Introduction to AutoHotkey: A Review and Guide for Beginners” page. You’ll obtain immediate, rewarding results with basic AutoHotkey. Then, as your comfort with scripting increases, introduce yourself to more of AutoHotkey’s power with some of the slightly elevated topics.

*          *          *

In the last blog, by writing the IH_VarText(Var) function, I created a clever (even if I do say so myself) yet uneasy technique for linking the Instant Hotkey combination to the insertion text by converting the key combination (full of illegal variable characters) to a legal two-deep variable. While this worked, in most cases, it left a number of holes in the subroutine. Unless I added a trap line for every possible illegal key (e.g. the semicolon ” ; “ key, the slash ” / ” key, the hyphen ” ‘ ” key, etc), errors might occur. I needed to make a change. Continue reading