• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

Basics of Creating a Hotkey: Extract from Intro to AutoHotkey in v2

How to create a Hotkey: Intro to AHK in v2 Extract
Intro to AHK v2 Hotkeys Extract


This video teaches viewers how to create hotkeys in AutoHotkey v2 for launching actions and performing various tasks.

  • 00:00 📝 Learn how to create hotkeys in AutoHotkey, which are triggers used to launch actions, in this extract from the Intro to AHK v2 Hotkeys course.
  • 00:49 📝 Creating hotkeys in AHK v2 is as easy as creating hot strings, with the only difference being the syntax for specifying the hotkey and the action, and modifier keys like Control, Alt, Shift, and Windows can be referred to using special characters.
  • 02:09 💡 To create a hotkey in AHK v2, use the character for the modifier key (e.g., control) followed by the desired key (e.g., enter) and separate them with a colon.
  • 03:03 📝 The speaker explains the difference between hotkeys and hot strings, and demonstrates how to create a hotkey that opens a website when a specific key combination is pressed.
  • 04:08 💡 The Run command in AHK v2 allows the user to execute files or open websites with their default application, making it convenient and efficient.
  • 05:12 🔑 You can easily create hotkeys for various actions like opening files, folders, or websites using AHK v2, with the hotkey command taking a hotkey as the first parameter and the corresponding action on the right side.
  • 05:58 💡 The speaker explains how to define and use a function in AHK v2 for performing actions based on a specific hotkey.
  • 06:50 💡 Create dynamic hotkeys in AutoHotkey by defining a variable and using an if statement to determine if the hotkey should be set or not.
hey it’s Joe Glines from the-Automator and this video we’re going to show you it’s an extract from our Intro to Autohotkey course intro and V2 that is and this is going to walk you through how to create HotStrings and Hotkeys right phenomenally helpful you can use them to launch things you can do using them for a lot of different stuff they’re think of them as triggers when you want to do
something is the most often used so in this video here is this is going to walk you through how to set them up I’m going to put up a coupon code or a link that’ll give you 20 percent off if you’re interested in getting the intro to AutoHotkey course it’s a great solid course I think it’s around four hours long most of videos are between three to five minutes this one’s a little bit longer butthey’re very very to the point and easy to follow they’re built for people who don’t know anything about
coding so check it out I hope you liked it please like the video If this helps you because it really helps us out cheers creating HotStrings so again anAuto Hotkey it is just a matter of specifying the Hotkey that you want and the action the only thing that changes a little bit is the syntax of how you do that let me go ahead and show you how to create static and dynamicHotkeys so if we open a new file we have our directives here for single instance and what it requires and in this case let’s
go ahead and create a Hotkey you have the hashtag like this so if I want to create a Hotkey that says Ctrl enter
or Ctrl shift enter I don’t have to write control or you know shift I don’t have to write any of that I just use the character that is designed for it and that’s the reason why on the Hotkeys because you because each each of them has a specific meaning but now to create a Hotkey let’s go ahead and say that I want to show a message box when I hit control enter so what I would do is I would have
to use the character for control which is the correct and then enter as a word like that and then I put two columns one after the Auto which defines that I’m doing a HotString instead of aHotkey here I don’t have the two columns at the beginning but I do have the two columns to divide the action in this case let’s go ahead
and do message box right and this is a test so now when I run this script whenever I hit Ctrl enter on my keyboard I will get this new box this is great as I mentioned it’s really easy and even though this example is very simple you could do many Auto things and actually very cool things for example just to show you how easy it is instead of a message box let’s do something a little bit more practical let’s say that I want to have a website show up whenever I press aHotkey so let’s go ahead and do control okay shift
F1 I can do this Ctrl shift F1 now what I could use in this case is the-Automator
website here I run this up and again as I mentioned this is Ctrl shift plus F1 in this case and this is Control Plus enter right so I’m running my script Ctrl shift F1 just goes ahead and open scrum with that page so just imagine how cool it is that you can create HotStrings and is
the same concept with the Hotkey command instead so this command takes a Hotkey as the first parameter notice that I’m actually putting quotation marks because this is literal text so this would be control so let’s say Ctrl shift enter in this case and then the action goes on the right side but the second side the the action that I’m going to perform is usually a function that you’re going to call and for that reason I do not have to put that in quotation marks because it is a function object and not only that I have
to Define define the function myself so let’s say open desktop this is going to be my function I just name it like that but as that is not literal text this is referring to a function you do not have to put quotation marks there but you do have to define the function somewhere else we will talk about functions later during the course but as a quick overview this function will take one parameter it is the plot key that I press this up and in the braces here I’m going to put the actions that I want to perform with this function in this case
what I want to do is run the desktop so a desktop is a variable that contains the path to my desktop and if I try to run a folder what is going to happen is that AutoHotkey is just going to go ahead and open the folder in Explorer so in this case this is the way to define a dynamic Hotkey which you can of cAutose use option right if you have a variable called option you can determine if it is true or false and if it is true then go ahead and use theHotkey and set theHotkey if it is false don’t set it so this is the way
to create Dynamic Hotkeys the-Automator this is how simple you can create Hotkeys in here

AutoHotkey Webinar- Intro to AutoHotkey

In 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 sharefull 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 script

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

 

 

 

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

keyboard shortcuts

Keyboard shortcuts

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

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.