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