Top AutoHotkey scripts to use Windows like a pro

Originally posted on my Blog.

What's AutoHotkey

AHK is an open-source scripting software for Windows that is used to automate repetitive tasks, remap keys, build small utility tools, etc. You create scripts that would do the tasks for you. It's an extremely lightweight app (~ 2MB RAM) and works on old and newer versions of windows.

How to set up and run

  • Download and install main program (one-time step) https://www.autohotkey.com
  • Download a script (.ahk) or copy-paste script content in a text file and then rename it with .ahk extension, e.g., my-script.ahk
  • To run the script: Right-click -> Run script. You can also run scripts by double-click or do right-click ->Open with -> AutoHotkey
  • Bonus: you can right-click and Compile script to make it a standalone .exe program that would run without installing AutoHotkey software on a computer.

Autorun script at startup

  • Open startup folder: open Run window by Win+R and then write shell:startup and enter.
  • It'll open explorer at something like this path: C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
  • Copy a script (*.ahk) -> go to that Startup folder -> right-click and select Paste shortcut.

Useful Scripts

You can see all scripts here: https://github.com/GorvGoyl/Autohotkey-Scripts-Windows

Look up selected text

script: look_up.ahk

use alt+g to open selected text in the browser and do a google search or visit the site (if it's url). It's one of the most frequent scripts I use on a regular basis. Especially to quickly google some error from the terminal when programming. Works everywhere.

Assign a different shortcut:

To assign a different shortcut, replace !g (here ! means Alt so !g = Alt+G) in the script with your desired key combo and run again. All running scripts can be found in the Windows tray menu.

To use a different browser instead of Microsoft Edge, Add its path instead of C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe in the script.

Use Win key as mouse left-click

script: mouseless.ahk

This little script has been a game-changer for me. I don't like to carry a mouse around, and my HP laptop touchpad isn't much responsive, so I needed a better alternative to performing left-click. I realized I don't use the left Win key as much, so I modified its action to do left-click instead (using left-thumb). Once you get the hang of it, I assure you you'll do clicks with godspeed.

I still needed the Win key, so I replaced the rarely used right Ctrl key as Win key.

To sum-up:
Win → Mouse Left-click
Right-Ctrl → Win

Show notification on low battery or when fully charged

script: battery_alert.ahk

Keeping your laptop constantly plugged in shortens the battery life!

If the battery is below 30% and the charger is not plugged in, it'll show a silent notification on the bottom-right corner to plug in the charger. Notification will pop up every few minutes until you take action.

And, if the laptop is charged and the charger is still plugged in, it'll show a silent notification on the bottom-right corner to remove the charger. Notification will pop up every few minutes until you take action.

Show popup to transform text

script: ctrl_caps_as_case_change.ahk

Use ctrl+capslock to invoke a handy transform text menu on selected text e.g., convert text to UPPERCASE/lowercase/Title Case etc. Press esc to close the menu.

Show Windows switcher with capslock key

script: caps_as_window_switcher.ahk

If you don't use capslock key much, you could replace it to show Windows switcher (e.g., Alt + Tab) instead. You'd still be able to turn on/off capslock with shift+capslock combo.

To sum-up:
Capslock → Alt+Tab
Shift+Capslock → Capslock

Create new text file here

script: create_file_here.ahk

Windows has a shortcut (ctrl+shft+n) to create an empty folder at the current location but not for creating a new file. So, I made a script to do exactly that. Use ctrl+shift+m to create an empty text file (NewFile.txt) at the current folder location in file explorer.

Open PowerShell here

script: open_shell_here.ahk

Use ctrl+shift+p to open PowerShell with the current folder path in file explorer.

In-line calculator

script: in-line calculator.ahk

Activate the calculator by = then write your equation and finally type = again to get the calculation result. Works everywhere.

Use # key at the end instead of = to keep the equation and the result (output: 7*5+5 = 40).

See more info in README file.

Drag window without activating it

script: MoveInactiveWin.ahk

Hold alt+right-click to move a window without activating it.

Disable zoom when ctrl+scroll in the browser

script: disable_scroll_zoom_edge.ahk

Disable zoom when doing ctrl+scroll in Edge browser. To use different application, replace Microsoft Edge with other application title in the ahk script.

Hot corner

script: left_edge_as_window_switcher.ahk

Trigger Alt+Tab (Window switcher) when the mouse is on the left edge of the screen. Keep the mouse there to tab through the other windows.

Pin window at the top

script: pin_window.ahk

Use ctrl+alt+p to pin/unpin current window at top. Super handy.

Win key to show taskbar

script: win_key_to_show_taskbar.ahk

It shows the taskbar only when the Win key is pressed; otherwise, it stays hidden.

👋 Comment below which script did you like the most :)


Thanks for reading. Connect with me on Twitter.