AutoHotkey Tip of the Week: Quick and Dirty Printing—September 30, 2019

If You Need a Hardcopy, Then You Can Use this AutoHotkey Print Technique—Plus a Cheap Way to Get Printer Ink

Library Benefits

Every once in a while you want to put something on paper. Most often, you open the appropriate program (i.e. a text editor or word processor for text documents, PDF viewer for PDFs, or graphics program for images) and print from that application. Trying to use AutoHotkey for direct printing can get pretty complicated (as discussed in Section 10.1.1 “Printing with AutoHotkey Made Simple” of the book Jack’s Motley Assortment of AutoHotkey Tips). But, for a quick printout, you can write an AutoHotkey line of code which sends a document to the printer from a program—without first opening the app.

Use Applications to Send Files Directly to the Printer

Light Bulb!This doesn’t work with all software packages, but you’ll find many programs offer this capability. For example, you can use AutoHotkey to open a text file for printing in Notepad with simply:

Run, Notepad.exe FileName.txt

However, to silently print (with no print dialog), add the print switch (/p):

Run, Notepad.exe /p FileName.txt

You save time and hassle by sending the text file straight to the printer without further interaction. (The Notepad window does open temporarily but immediately closes after formatting and sending the text file to the printer.)

This approach makes printing with AutoHotkey simple because the program handles all of the required settings for both the document and the printer. For a partial list of print parameters for common programs, see this collection of command-line switches. Depending upon the program you may need to set defaults in the program prior to sending an external print job.

Note: When I use Foxit Reader to print PDF files directly, the program Window doesn’t even open.


Printing Files from QuickLink.ahk

I use this print technique in the QuickLinks menu script to print various types of files. (See the blog “Open and Print Files with the QuickLinks App.”) You can find detailed explanations for how to set up and use the QuickLinks.ahk app in Digging Deeper into AutoHotkey and the Motley Assortment of AutoHotkey Tips books.

Get Cheap (or Possibly Free) Printer Ink

The bane of inkjet printing lies in the ink. It tends to be expensive and runs out too quickly. If you don’t use your printer enough the ink dries up. If you use it a lot, you can easily end up spending far more on printer ink than you did on the printer itself. I seem to have found a solution that works for me.

After buying my current HP printer I signed up with HP Instant Ink. I get charged $3.00 per month for 50 printed pages. (Unused pages roll over to the next month—up to 100 pages.) The annual cost of $36 seemed like a deal when compared to the price of regularly buying ink whenever it ran dry. Considering the price of ink cartridges I took a chance with the subscription service. I’m glad I did.

I chose the 50-page per month plan but HP offers subscriptions for up to 700 pages per month for $19.99. HP even offers a free introductory plan for printing less than 15 pages per month. HP keeps track of the number of pages you print via the Internet with the Web site displaying your print history. (This ink program may not be available for older HP printers.)

I print about 30 pages a month of various types of files. If I need to supply extra documentation to someone, the number can run a little higher. I used to worry about how much ink I wasted—especially color. Not any longer! In fact, as long as I don’t overdo the number of pages, I deliberately use as much ink as I can. Plus, I use color as much as possible in hopes that I will run out and make HP send me more.

I’ve even started printing photo-quality collages for family members. Previous, a couple of these projects would quickly wipe out at least one or two color ink cartridges. I avoided using anything but black ink since those cartridges generally contained the most ink. I dreaded using the printer since it might force me to buy more ink. Ironically, I owned a printer which I didn’t want to use for printing. I have eliminated that concern.

Free Printer Ink

If you print very little, HP Instant Ink has a plan for you. You can print up to 15 pages a month free. (Additional pages $1.00 per 10 pages with no rollover.) You continue to pay for paper but you get the ink free. It wouldn’t work for me, but for those people who own a printer yet avoid ever printing for fear of the ink running dry, this might be just the ticket.

Okay, I don’t like recommending anything HP. A few years ago they screwed me on a printhead warranty. However, in this case, if you own a qualifying HP printer, then I have to give them their due. The plan frees you up to use the printer the way you want to use it without breaking the bank.

(Full disclosure: If you signup for HP Instant Ink using one of my links, both you and I might get one free month of service. I don’t know if this applies to the free ink subscription. However, my saving $3.00 has no impact on the opinions I express here.)

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


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



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s