Understanding AutoHotkey %Var% Variable Text Replacement (AutoHotkey Tip)

Handy Window Transparency Wheel Using Macro Replacement Quickly Peeks Under a Window without Moving It, Plus the Difference Between % Var and %Var% Made Easy

The AutoHotkey online documentation goes into great detail about the traditional method for retrieving values from variables (%Var%) and the force expression evaluation method (% Var). It can take the new AutoHotkey user a little while to comprehend the differences between the two. In an effort to clarify the variations and help beginners to understand when to use which method, I offer an alternative way to view the operations. For the traditional method, I prefer using the terms macro substitution or variable name replacement. Once, you understand how it works, differentiating when and how to use each technique becomes easy.

The value-added trick comes when creating variables containing new variables on-the-fly by combining the two methods (i.e. forcing an expression % which contain a %Var% variable name replacement). The first step involves replacing the variable with its value, the new variable name (%Var%). The second step requires the forced evaluation of the new variable (% VarValue) as part of an expression.

*          *          *

Volume Control
Volume Wheel

A while back I installed a volume control operated by the mouse scroll wheel. Simply hover over the Windows Task Bar and scroll the mouse wheel up or down to adjust the PC speaker volume level higher or lower, respectively. A progress bar (shown at right) pops up displaying the changing volume level. I’ve added this convenient tool to my standard AutoHotkey script and use it all the time.

Tranparency Menu
Transparency Menu

At a later date, while playing with window visibility, I set up a menu for changing the transparency level for the active window (shown at left). At the end of that blog, I suggested, “If you want to get really fancy, then you might use the mouse wheel to set the transparency (or opaqueness) level.” I’ve done just that with my new SeeThruWinWheel.ahk script. Now, by holding down the CTRL key while scrolling the mouse wheel, the window under the mouse cursor becomes less opaque (WheelDown) or more opaque (WheelUp). In the course of writing this short script, I implemented a number of AutoHotkey tricks worth discussing. Continue reading

Stop Accidental Deletions with the BlockInput Command (AutoHotkey Tip—Part Two)

AutoHotkey BlockInput Command May Cause Stuck Keys! Fix It with the KeyWait Command

In the last blog, we dealt with the issue of setting the privilege level required to use the BlockInput command. In the BackupText.ahk and IncrementalSaveText.ahk scripts, the AutoHotkey command prevents user mouse/keyboard input while the script selects and copies text to the Windows Clipboard, but it doesn’t work without Administrator privileges. After raising the script to a higher level, we demonstrated how to use Windows Task Manager to bypass the User Account Control (UAC) warning window.

At the end of the blog, I mentioned an additional problem where BlockInput causes keys (usually one or more from the Hotkey combination) to stick in the down position. Here’s the trouble. Continue reading

Stop Accidental Deletions with the BlockInput Command (AutoHotkey Tip—Part One)

Ever Wonder Why You Might Want to Block Keyboard and Mouse Input? Here’s One Reason to Use the BlockInput AutoHotkey Command, Plus the Associated Problems

I added the BlockInput command to both the BackupText.ahk and IncrementalSaveText.ahk scripts. I did this to prevent the accidental deletion of the target text by an errant press of a key.

To check out whether the command operated or not, I added a time delay to the script looking for the halting of keyboard and mouse action with BlockInput On. It didn’t work! My experiment demonstrated that the BlockInput command blocked nothing. There’s a good reason for this. Continue reading

Get the Free AutoHotkey Tricks Book at Apple iBooks, Plus RegEx Book Update

How to Find the Free AutoHotkey Tricks Book on Apple iBooks

AutoHotkey_Tricks_150Even though you can now get AutoHotkey Tricks You Ought To Do With Windows (Fourth Edition) free on Amazon.com, you can’t get it free in the United Kingdom or other non-US Amazon sites—at least not yet. Of course, you can always download it directly from our free page no matter where you live. However, alternatives are now available—in particular Apple iBooks. The following links direct you to Apple pages which offer AutoHotkey Tricks free in various parts of the world:

United States

Apple iBooks

Barnes and Noble Nook

Kobo

United Kingdom

Apple iBooks

Canada

Apple iBooks

Australia

Apple iBooks

Germany

Apple iBooks

Spain

Apple iBooks

France

Apple iBooks

Italy

Apple iBooks

Brazil

Apple iBooks

Japan

Apple iBooks

These promotions contribute to my efforts to make the Windows world more aware of the benefits of AutoHotkey. You may also find the book free at other Web outlets.

*          *          *

Don’t Forget! Why AutoHotkey? book giveaway on Amazon,
on Monday, May 1, 2017! Tell a friend!

*          *          *

How to Update Your Copy of Digging Deeper into AutoHotkey or AutoHotkey Applications

Cover 200I’ve completed the update of A Beginner’s Guide to Using Regular Expressions in AutoHotkey. The old Dropbox Download page and other obsolete links in the e-books have been updated reflecting the Free AutoHotkey Scripts page which now supports all available AutoHotkey scripts. (For direct access to the files, go to the ComputorEdge AutoHotkey Download page.) I uploaded the latest version of the book to Amazon and all formats on ComputorEdge E-Books. (I only one book to go and since it is the most recent book, I think it will go quickly.) Continue reading

AutoHotkey Tricks E-Book for Kindle Now Free on Amazon

If You Use the Amazon Kindle, Get Your Copy of AutoHotkey Tricks Directly from Amazon—Free!

AutoHotkey_Tricks_150Already free everywhere else, you can now obtain a copy of AutoHotkey Tricks You Ought To Do With Windows directly from Amazon at no cost. The book offers a number of ways you should use AutoHotkey, but, more importantly, it includes the “Table of Contents” and “Book Index” from each of the other six paid AutoHotkey e-books. It acts as a handy reference for anyone looking for a specific scripting solution. One search of this e-book scans the indexes of all six books in one go.

While AutoHotkey Tricks is always free, the next free giveaway of the Why AutoHotkey? book on Amazon is next Monday, May 1, 2017! Tell a friend!

Digging Deeper into AutoHotkey and AutoHotkey Applications E-Books Updated April 26, 2017

How to Update Your Copy of Digging Deeper into AutoHotkey or AutoHotkey Applications

I’ve completed the updates of Digging Deeper into AutoHotkey and AutoHotkey Applications. The old Dropbox Download page and other obsolete links in the e-books have been updated reflecting the Free AutoHotkey Scripts page which now supports all available AutoHotkey scripts. (For direct access to the files, go to the ComputorEdge AutoHotkey Download page.) I uploaded the latest versions of the books to Amazon and all formats on ComputorEdge E-Books. (I plan this update for each of my books and will announce it on this blog when each new edition becomes available.) Continue reading

A Beginner’s Guide to AutoHotkey E-Book Updated April 19, 2017

How to Update Your Copy of A Beginner’s Guide to AutoHotkey

Beginner's Guide to AutoHotkeyAfter the AutoHotkey Hotstrings book, I immediately moved on to updating my first AutoHotkey e-book, A Beginner’s Guide to AutoHotkey. The old Dropbox Download page and other obsolete links in the e-book have been updated reflecting the Free AutoHotkey Scripts page which now supports all available AutoHotkey files. (For direct access to the files, go to the ComputorEdge AutoHotkey Download page.) I uploaded the latest versions of the book to Amazon and all formats on ComputorEdge E-Books. (I plan this update for each of my books and will announce it on this blog when each new edition becomes available.) Continue reading