• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Intro to DOS & AutoHotkey AutoHotkey FAQ1 AutoHotkey FAQ2

AutoHotkey Webinar- Intro to AutoHotkey

webnar 300x200In this webinar we cover an Intro to AutoHotkey.

Video Hour 1: High-level overview: Hour 1
Video Hour 2: Q&A: Hour 2

Script Highlight: Minimize to tray–  This is an “old” AutoHotkey script but is super-cool!   When running you simply press the Windows Key & H and the active program will “disappear”.  It works on multiple windows.  Then, when you want them back, press Windows & U and the windows will be visible again.

Intro to AutoHotkey

  • AutoHotkey is free, open-source, Windows scripting language
  • Created in 2003 from Chris Mallet it was an off-shoot of AutoIt
  • AHK is user-friendly for non-programmers but is also used by programmers as it “hooks” into Windows & windows programs very well
  • The core language is very descriptive and typically isn’t too hard to grasp
  • Scripts are easily “compiled” into an executable which can be easily shared
  • You do not need to install AutoHotkey to run it. (It can be run from a thumb-drive)

What can AutoHotkey do?

You can automate virtually anything on a Windows computer!  Here are some uses:

  • HotStrings: think text expansion on your phone or spell-check in MS Word
  • HotKeys: Launch programs with a click of a button
  • Files & Folders: Manipulate, read, move, delete etc.
  • Automate programs : Outlook, Word, Excel, SPSS, VLC, Adobe, etc.
  • Connect to Windows API: Programmatically affect Windows & other programs
  • Web Scrape: Reliably download data from webpages &/or manipulate /complete forms
  • Web Service APIs: Many vendors allow you to query their services
  • Create GUIs: Simplify interacting with scripts by creating a GUI to manipulate
  • Regular Expressions: use pattern matching on text files to extract or re-arrange the text
  • Audio & Image Manipulation: Screen clipping, OCR, extract audio, Video recording, etc.
  • So much more!!!

AutoHotkey Resources

Installation of AutoHotkey

Go here and download the current version of AutoHotkey https://www.autohotkey.com/download/

During installation, we recommend installing the Unicode 32-bit version of AutoHotkey

Installing a Default AutoHotkey Editor

AutoHotkey code is “plain text” and pretty easy to read

Having said that, using an editor / IDE, instead of notepad, is very helpful!

Below are links to the three most popular AHK editors.  Are all equally good as are many others).  For our demonstration we are going to use SciTE (pronounced ‘sight’)

  • SciTE4AutoHotkey  is a great editor for AutoHotkey.  Here are a bunch of videos demonstrating how to Customize SciTE
  • AutoHotkey Studio  Great editor specific to AutoHotkey.  Check out the demo in this webinar
  • Notepad ++  Another great editor which is customized for working with AutoHotkey

Before Your First AutoHotkey Script

Before we start coding, here are some basics which will help you

  1. #SingleInstance, Force: Put in all scripts. This Forces 1 instance of the script
  2. The Green icon with white H   in system tray shows you the script is running
  3. Every time you make changes to your script, you need to Reload / Launch it for the changes to take affect
  4. Frequent Modifier keys (for HotKeys) are: ^=Control #=Windows +=Shift  !=Alt
  5. Frequent Special Characters (for HotStrings) are:#,!,+,;  Wrap them with {}
    1. For a New Line, use `n, for a tab use `t

 

Your First AutoHotkey Script

Hotkey

Copy & Paste to Excel

Troubleshooting & Debugging

  • Watch our AutoHotkey webinar on Troubleshooting & Debugging (or join a future webinar and ask questions in the second hour)
  • Work through our HotStrings Udemy course
  • Is script running / Green icon with white H in system tray
  • If Green H Icon, Restart script
  • Double-click icon & look at: last lines run, Variables & their contents, Hotkeys & their methods, Key history
  • Close all other scripts & programs & retry
  • If still not working, start using msgbox to “walk through” the script
  • Try using ListVars & ListLines
  • Read documentation on specific command/function you’re having issue on. Search forum/StackOverflow for examples
  • Try running your script as Admin
  • Temporarily turn-off UAC (User Account Control)
  • Is your issue after the Auto-Execute Section?
  • If Context-sensitive, remove context sensitivity & run general
  • Reboot the computer (hey, it’s Windows…)
  • Search the AutoHotkey Forum, Stack Overflow for similar issues
  • Is the problem consistent & repeatable?
  • Does it happen on other computers?
  • What, specifically, isn’t working? Break down the part that isn’t working into it’s-own script. Provide specific example to AHK Forum, StackOverflow, or friend after spending at least 30 minutes on it yourself. You can also check Discord for live feedback/support.
  • For SciTE debugging, you can check out videos on this post

 

Use AutoHotkey to get path from Explorer & replace w/UNC path for sharing

path from explorer

Use AutoHotkey to get Path from explorer and shareAutoHotkey Bottle 1full path with others

Working on multiple computers, in multiple environments, and with teams of people can be a challenge when wanting to share files.

I have quite a few network folders that I’ve “mapped” so they look like drives.  This always causes issues when copying the path and sharing with others.   I also have a “b:” drive that I’ve created which, in reality, is a shortcut to the root of where my DropBox folder is located.

Registry settingsThe 1st thing I’m going to recommend is that you backup your registry!!!     After doing so, navigate to this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices

 

 

Then right click on the right and create a new String.  This is where you’ll put in the letter of the drive you want (for instance I put in B: ).  After you’ve done that, right click on the B: and  add the path to the folder you want mapped.  Here’s an example  “\??\C:\\Dropbox\test\”  Please note the second \ after the c:\   It is not a typo!   For some weird reason you need two there however everywhere else after you just need one!

The next time you boot up you’ll have the new drive (this isn’t creating any sort of copies of files, it is merely giving you a convenient shortcut to a folder)   Here’s a screenshot of my settings.

Mapping network drives are easy and you can follow this guide here.

Okay, now that we’re done setting up our computer, let’s get to the AutoHotkey scriptWhite sticker on computer 4

Copy Path from explorer and replace with UNC (for sharing and to get around security issues)

Here’s a video demonstrating getting the Path from explorer

AutoHotkey Bottle 2

 

 

 

Keyboard shortcuts for launching programs- Start any program with 1 click

keyboard shortcuts

Keyboard shortcutsWhite sticker on computer 4

Keyboard shortcuts can be a great time saver (especially for specific programs, folders, actions) that you do dozens of times a day.

 

Over a decade ago I put the below file together documenting the most frequently used Windows / Office shortcuts

keyboard shortcuts

MS word file great keyboard shortcuts

AutoHotkey Bottle 3

Now-a-days AutoHotKey to create my own shortcuts (of which I have over 100 which do various activities by a simple click of the key/button.)  AutoHotKey has a function for this called Hotkeys which are a great way to launch programs / scripts /folders that you use frequently.

This video walks through how easy it is to set up hotkeys to launch programs, scripts, etc.

 

Click window to toggle programs across monitors with AutoHotkey

toggle programs across monitorsToggle programs across monitors with AutoHotkey

Do you work with multiple monitors?  I have an awesome AutoHotkey script which allows me to simply hold down Alt and mouse-click on a program and it will “throw” it to the other monitor!.

Toggle programs across monitors with AutoHotkey

Here is the AutoHotkey Script to toggle programs across monitors

Being able to toggle programs across monitors is an amazing thing!