≡ Menu

Reduce Keystrokes using AutoHotKey for Windows- Productivity Tip#2 for Geeks

AutoHotKey Logo
For geeks to be more productive, using keyboards as much as possible is a must. AutoHotKey for windows is an excellent tool that can automate repetitive typing. Using scripting in AutoHotKey, you can pretty much perform any activities on Windows. This is a jumpstart guide to get you started on the AutoHotKey.

Install and Configure

  1. Download the AutoHotKey and install using the default options.
  2. Launch the AutoHotKey, which will display a dialog confirming that a sample script file will be created.  Click on “Yes” to create the sample AutoHotkey.ahk in the My Documents folder. Later if you want to create a script file under a different directory, from the Windows Explore menu click on File -> New -> AutoHotKey Script.
  3. Make sure AutoHotKey is running in the windows task bar. You can also open the AutHotKey.ahk script by right-mouse click on the AutoHotKey icon from the system tray and select “Edit this script”.
  4. Anytime you make changes to the AutoHotkey.ahk, you need to Reload the script by right-mouse click on the AutoHotKey icon on the system tray and select “Reload this script”.

Basic Usage of AutoHotKey

(1)  Email Signature. Add the following two lines to the AutoHotKey.ahk and reload the script as explained above. For testing, open notepad and type -rn, which will be automatically replaced with the full name “Ramesh Natarajan” as defined in the *.ahk file.  Comments in the AutoHotkey.ahk begins with semi-colon.

; tip#1 - Type long names quickly
::-rn::Ramesh Natarajan

(2) Email Signature with multiple lines. In this example, typing “rtgs” from my email message will add the multiple-line content located within the parenthesis ( ). It is important to choose a keyword that you can easily remember and not common words that could potentially be replaced automatically by mistake.

; tip#2 - My personal email signature with the URL
::rtgs::
(
Ramesh
<a href="https://www.thegeekstuff.com">The Geek Stuff</a>
)

(3) Current Date and Time: When you are taking notes in a textpad, sometimes it may be a good idea to put the current date and time before you start taking notes. In the following example, when you type “ndate” from the notepad, it will add the current date and time in the format mentioned below.

; tip#3 - Adding the timestamp quickly while taking notes
:*:ndate::
FormatTime, CurrentDateTime,, M/d/yyyy h:mm tt  ; It will look like 6/29/2008 10:35 AM
SendInput %CurrentDateTime%
return

(4) Open a website in a browser: Sometime it may be necessary to open your frequently used website with a single key stroke. In the following example, typing “Windows” key + “t” will open the default web browser and launch www.thegeekstuff.com. Please note that “#” in the following line represents the “Windows” key in the keyboard.

; tip#4 - Open frequently used website
#t::Run www.thegeekstuff.com

(5) Open frequently used folder by pressing “Windows” key + “p”.

; tip#5 - Open frequently used folder
#p::Run "C:\my-project\projectplan"

(6) Open frequently used document by pressing “Windows” key + “c”

; tip#6 - Open frequently used document
#c::Run open "C:\my-project\documents\codedesign.doc"

(7) Advanced scripting. In the following example, you can select any text from any application and press “Control+Alt+w”, which will open the Notepad++ application and paste the selected text.

; tip#7 - Advanced scripting
^!w::
Send, ^c
SetWorkingDir, %ProgramFiles%\WordNet\Notepad++\
Run, notepad++.exe
WinWait, Notepad++
WinActivate
Send, ^v{Enter}
return

References:

Do you use any other keyboard productivity tips? Please leave your comment.

Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Ajith Edassery July 23, 2008, 12:40 am

    Nice blog you have… I have subscribed to your feed via my Google Reader.

    Cheers and good luck,
    Ajith
    PS: Thanks for visiting my blog today

  • Michael Chalk August 20, 2008, 1:44 am

    Hello Ramesh ..

    i found auto hotkey too, and i love it a lot !!

    They have so many user scripts on the site .. i’ve only started with an autotext script, and it’s so enjoyable to use.

    kind regards, michael

  • Alejandro Torres Frías August 30, 2008, 5:56 pm

    I agree on finding Autohotkey an essential tool for a modern professional.

    I use the text replacement tricks a lot. Same thing with having scripts for launching the different browsers (Firefox, Flock, Opera., Safari and IE) with different home pages, or sets of tabs previously opened. You can use Autohotkey for many things really.

    A tip that works great with Autohotkey, is to locate the script itself in the Start Folder to avoid having to activate it everytime you turn your computer on.

  • Tom Aesop October 25, 2010, 12:30 am

    I just want to say thank you for making this guide.
    I knew AutoHotKey was the solution to customer service repetition,
    but this is really remarkable. Great tutorial. In 2 minutes of reading
    you’ve already saved me two hours tonight.

  • lee leblanc May 4, 2015, 9:50 am

    So helpful. Thanks! I returned here to check some ahk code again -and to properly credit you in my .ahk scripts -since you were the inspiration for my date script. I modified the orignal idea to give me 2 options for the date: nd- and nd/. One allows for dashes in Month-day-Year. That’s mostly used for plain text notes and files needing a date string in their name. The other allows for a year, month, day in slash format for inline documentation when I’m coding or blogging.
    ###
    ; Adding the timestamp quickly while taking notes
    ; courtesy of Ramesh Natarajan on July 20, 2008| thegeekstuff.com
    ;#NoTrayIcon
    #SingleInstance force

    ; Month Day Year string
    :*:nd-::
    FormatTime, CurrentDateTime,, MM-dd-yyyy
    ; can append at end for time –> h:mm tt |will look like: 05-04-2015 10:35 AM
    ; It will look like 05-04-2015
    SendInput %CurrentDateTime%
    return

    ; Year Month Day string
    :*:nd/::
    FormatTime, CurrentDateTime,, yyyy/MM/dd
    ; It will look like 2015/05/04
    SendInput %CurrentDateTime%
    return