AutoHotkey Tips of the Week: The ComObjCreate() Function for Web Page Downloads, E-Mail, and Text Audio

While AutoHotkey Directly Supports Most Windows Features, the Flexibility of the ComObjCreate() Function Adds More Useful Capabilities—Especially for Capturing Web Data, Sending E-mail, and Reading Text Out-Loud

A number of my scripts use the ComObjCreate() function in various forms. Most of them I copied from the AutoHotkey Forums and modified for my own purposes. In this blog, I highlight the ComObjCreate() applications I use most, then offer a list of other forms of the function you may find useful.

How I Use ComObjCreate()

Synonym Page
The SynonymLookup.ahk script pulls replacement terms for the highlighted word “Page” from the Web.

While AutoHotkey supports many of these features in one form or another, directly accessing the COM (Component Object Model) might provide a solution you can get by no other method. I use the ComObjCreate() function in three ways:

  1. Collect data from Web pages (ComObjCreate(“WinHttp.WinHttpRequest.5.1”)).
  2. Send e-mail directly from an AutoHotkey script (ComObjCreate(“CDO.Message”))—no mail program required.
  3. Use the computer voice to read text (ComObjCreate(“SAPI.SpVoice”)).

While I haven’t found much additional information about the ComObjCreate() function posted on the new AutoHotkey forum, the old forum contains a useful COM Object reference list. You don’t need to know how they work—just how to use them. Continue reading

AutoHotkey Tip of the Week: Add Power to Any Command with Forced Expressions (%)—October 7, 2019

Use the Forced Expression Operator (%) to Adapt AutoHotkey Commands On-the-Fly

Light Bulb!Most AutoHotkey Version 1.1 commands use plain text as parameters. That means AutoHotkey interprets the text exactly as written—no quotes needed and no variables accepted. In version 1.1, this would limit the commands except for the availability of the traditional (or legacy) double-quote text replacement operator (%var%).

The %var% technique allows us to substitute any variable directly into an AutoHotkey command. However, using the forced expression operator (%) adds even greater flexibility and power to almost any AutoHotkey code. In many cases, rather than developing complicated subroutines, you can use this technique to embed expressions and functions directly into version 1.1 AutoHotkey commands. Continue reading

A New Hotstring Trick and Converting Dates in Documents into DateTime Stamps (Coming Soon!)

Making a List of Future Blogs While Sequestered

ProgrammingRobotRight now, the massive book of motley AutoHotkey tips consumes the vast majority of my time. Therefore, I have less blogging time. However, I don’t want my lack of blogs to make anyone think I sit idle. In the course of the current task at hand, I’ve accumulated even more topics which I need to blog about: Continue reading

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

Write Less Code with Database Driven Apps (AutoHotkey Script Design)

Use Simple Database Files to Both Write AutoHotkey Code and Create Flexible Scripts

GraphicSoundsIn the last blog, I introduced a simple AutoHotkey app I call PictureSounds.ahk. When the user clicks on an image, AutoHotkey seeks the name of the sound file in an INI lookup table, then plays it. The script uses the image file name as the INI file Key. After loading a series of images, the script plays a different sound for each image. (It even plays videos!)

Using the INI file as a lookup table saved me from writing a different subroutine (or at least If condition) for each Picture control in the GUI window. Now, I show how to use that same data file to write the command code lines for adding the images to the pop-up files. Continue reading

Building a Lookup Table with an INI File (AutoHotkey Reference Tip)

In AutoHotkey, You Can Use an INI File as a Database for Relating Lookup Table Items

Admittedly, AutoHotkey lacks sophisticated database tools for storing, sorting, and reporting sets of information. While you can piece together commands to create pretty good database file systems, AutoHotkey does not hold a candle to specialized data handling software packages which use SQL and other high-powered relational tools. However, AutoHotkey does support a simple form of a database called an INI file with built-in commands which make it easy to read and write data. These features give us a method for building a lookup table to relate our AutoHotkey Version 1.1 commands to 2.0 functions references. Continue reading

New “Why AutoHotkey?” Book Available Free on Amazon

For One Day, Monday, May 1, 2017, the Just Published E-Book Is Available for the Kindle and Kindle Apps on Amazon.com

CoverWhy200I’ve made the new e-book Why AutoHotkey? available exclusively on Amazon and you can get the book free. It’s not that you need the book since most of its contents can be found right here on the Why AutoHotkey? page. I’ve produced this book for people who don’t know about or use AutoHotkey. As you are already accessing this blog, you’re likely well aware of AutoHotkey. My goal with this new book is to reach the AutoHotkey unaware. I’m guessing the Amazon is loaded with those types of Windows users.

I plan to make the book free more times, but Amazon only allows me to give it aways five times in a three-month period. (I would always make it free if they would let me.) Don’t worry if you miss this one. I’ll announce in this blog whenever I schedule another free book day. (Sign-up to follow the blog at the upper right of this page if you want notification whenever a new blog comes out.)

I know…I’ve expressed my disdain for the way Amazon treats independent writers, but they have such a huge reach, it would be silly for me to completely ignore them. (I still prefer people buy from ComputorEdge E-Books, but everyone must have an option.) This new compilation book should help the uninitiated to understand how much power AutoHotkey can bring to their Windows PC.

 

Why AutoHotkey for Teachers and Educators?

AutoHotkey Library Deal
AutoHotkey Library Deal

The varied computer situations of educators present a particular problem for AutoHotkey use. AutoHotkey works only on Windows computers. Fortunately, 90% of the desktop and laptop computers currently in use run Microsoft Windows. On the downside for teachers, they may or may not RobotWordProcessorCartoonhave access to Windows machines in the classroom. Plus, even if students have a computer available at home, not all of them are Windows PC. This makes it difficult to create consistent computer-dependent lesson plans covering everyone in the class.

Noting the difficulties with applying a Windows-based program to schooling, I forge on with the possibilities for those instructors in a position to take advantage of AutoHotkey. Continue reading

Why AutoHotkey for Grandparents?

Remember All Your Grand Kid’s Birthdays and Their Ages! There’s No Limit to the Number of Ways You Can Amuse Your Grandchildren with AutoHotkey, Plus It Gives Your Brain a Much Needed Workout!

If you only have one grandchild, then you probably won’t have much trouble recalling his or her birthday or age. In that case, you may not have much interest in the grandbotslittle AutoHotkey GrandKids.ahk script. However, AutoHotkey offers much more which can enrich your offspring’s offspring’s education and entertainment—including a one-line script which verbalizes out loud the letters and numbers on the computer keyboard. But more importantly, learning to write AutoHotkey scripts exercises your mind—something everyone needs.

*          *          *

Some of the scripts in this blog may not make AutoHotkey look easy, but you’ll find the first steps to AutoHotkey literacy quite simple. For a comfortable startup, check out this Introduction to AutoHotkey.

*          *          *
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