Simple AutoHotKey Scripts To Make Your Life Easier | Daily PC Use

With just a few lines of code, you can create something that will change the way you use your keyboard and PC for years to come. For more than a decade now, I’ve had an ever-changing AutoHotKey script sitting in my Windows startup – without some of what it enables, I’d be completely lost.

all you have to do is download the application, bring up a text editor, and save and run any of the following scripts to get them working immediately.

Repurpose The Function Keys

For many of us, the function keys (F1–F12) end up completely unused. Depending on your keyboard layout, the reach to this row of keys could be an uncomfortable trade-off compared to their functionality. For others, these keys may simply be useless.

My favorite thing to do with the function keys is to set them to launch programs that I often use but don’t often keep open. Notepad is a great example.

F1::Run "%WINDIR%\notepad.exe"

The above script sets the F1 key to launch Notepad in any modern version of Windows. As you can see, the file path supports both a direct path or one of Windows environment variables. Using environment variables is ideal if you use multiple different versions of Windows.

Use Special Characters


As a massive fan of the em dash, it’s frustrating that the vast majority of keyboards don’t natively support it—so, let’s make them.

!-::Send {—}

The above script will insert an em dash when the Alt + – keys are pressed. Alt is a great modifier to use for your hotkeys because it sees much less use compared to Shift and Ctrl.

Another solid idea is to bind ellipsis to Alt + . , which can be performed with the following one-liner:

!.::Send {…}

As a writer, using AutoHotKey for easy access to punctuation marks saves me an incredible amount of time.

Control Your Volume


Not everyone has a keyboard that supports multimedia keys, but that shouldn’t stop anyone from the joys of controlling their music with ease.

My favorite way of implementing this is by using the Shift + Page Up key to turn the volume up, Shift + Page Down key to turn the volume down, and Shift + Pause key to mute (toggleable).

+PgUp::Send {Volume_Up}

+PgDn::Send {Volume_Down}

+Pause::Send {Volume_Mute}

Of course, there’s the chance that you may be on a keyboard where that layout isn’t very practical. You can simply change any of the key names above to your liking by checking out AutoHotKey’s list of keys.

Pin a Window On Top


This might be my favorite AutoHotKey one-liner of them all. The ability to pin a window on top of others is one that can save you a major headache while working, trying to enjoy a movie or plenty of other activities at your desk.

^Space::Winset, AlwaysOnTop, , A

I find this one to be especially useful if you have a decent-sized monitor but not a dual-monitor setup. With the script above, that calculator will no longer get buried under all of your other windows! Just press Ctrl + Space to pin (or unpin) a window.

Search Google Instantly


If you’re someone who uses your computer every single day, you probably spend more time than you notice searching Google for terms that you come across while talking to friends or surfing the web.

However, selecting text, copying it, opening a new tab, pasting the text into your address bar, and pressing the Enter key is an awfully long process. Why not make it simpler?


Send ^c

Sleep 50

Run ""


The script above allows the Ctrl + Shift + C hotkey to do all of that in a single hotkey as long as you’ve highlighted the text you want to search for. The Google Search page will be brought up in your default browser.

If you can’t pick just one of these scripts, there’s good news: All you have to do is paste each of them on a new line, and they’ll all work seamlessly together!


As long as you haven’t altered the hotkeys to create conflicts, using all five of the above scripts at once within a single AHK file should work perfectly fine.



so nice thanks


Thanks :blush: @SaM.
I’ll try that with my Photoshop…


I have a lot of AHK shortcuts in a large script myself after I remapped my entire keyboard to be similar to the MacOS keyboard shortcuts, which make the shortcuts easier on my fingers. I could show these, but I doubt anyone wants to change their Windows muscle memory, so I’ll share a few others instead:

1] CTRL+ALT+SHIFT+BACKSPACE: empty Windows trash (note: it’s done in the background so you won’t see any empty trash dialog therefore you cannot cancel this - USE AT YOUR OWN RISK!)


2] CTRL+ALT+SHIFT+H: toggle hidden files in Windows Explorer (show or hide on each press)

	RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden 
	If HiddenFiles_Status = 2  
		RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1 
		RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2 
	WinGetClass, eh_Class,A 
	If (eh_Class = "#32770" OR substr(a_osversion, 1, 2) = 10) 
		send, {F5} 
		PostMessage, 0x111, 28931,,, A 

3] WIN+ALT+SPACE: start SublimeText, or show/hide SublimeText if already started (the below can be adapted to any program, allowing you to use one single shortcut to start, hide or show the program :wink: )

#If !WinExist("ahk_exe sublime_text.exe")
	Run C:\Program Files\Sublime Text 3\sublime_text.exe

#If !WinActive("ahk_exe sublime_text.exe")
	WinRestore ahk_exe sublime_text.exe
	WinActivate ahk_exe sublime_text.exe

#If WinActive("ahk_exe sublime_text.exe")
	WinMinimize ahk_exe sublime_text.exe
	WinActivate, ahk_class Shell_TrayWnd

4] CTRL+[ and CTRL+] inside Excel to switch/alt-tab worksheets

#If WinActive("ahk_exe EXCEL.EXE")
^2::Send {Ctrl down}{PgDn}{Ctrl up}
^1::Send {Ctrl down}{PgUp}{Ctrl up}

5] alternative browser shortcut keys for going back/forward in history on a page (use only if you want the same shortcut key across browsers, or if you don’t like the default Chrome “alt+left” / “alt+right” keys or the default Firefox “backspace” / “shift+backspace” keys)

ALT+[ or CTRL+, or ALT+, = back one page in history
ALT+] or CTRL+. or ALT+. = forward one page in history

#If WinActive("ahk_exe chrome.exe")
![::Send {Alt down}{Left}{Alt up}
!]::Send {Alt down}{Right}{Alt up}

#If WinActive("ahk_exe firefox.exe")
![::Send {Backspace}
!]::Send {Shift down}{Backspace}{Shift up}

6] F4 inside browsers to close the current Tab instead of the default ctrl+w (useful when opening many pages/images in background tabs and you want to go through them and close them one by one)

#If WinActive("ahk_exe chrome.exe")
	F4::Send ^w

#If WinActive("ahk_exe firefox.exe")
	F4::Send ^w

7] CTRL+Q alternative to ALT+F4 (useful to avoid hitting the wrong F-key)

^Q::Send {Alt down}{F4}{Alt up}

8] ALT+W or WIN+W alternative to CTRL+W to close a tab (fingers are more relaxed when using alt+w or win+w instead of the default ctrl+w)

!w::Send {Ctrl down}w{Ctrl up}

9] disable showing the Windows Language context menu to avoid switching the input language by mistake:


10] WIN+TAB and WIN+SHIFT+TAB to disable the slow & annoying Windows task view interface and replace it with regular ALT+TAB functionality:

#Tab::Send {Alt down}{Tab}{Alt up}
^!Tab::Send {Alt down}{Tab}

11] CTRL+WIN+ALT+X: restart the explorer.exe process (e.g. for cases when the taskbar freezes, or when explorer crashes, etc.)

	WinGet, h, ID, ahk_class Progman
	PostMessage, 0x12, 0, 0, , ahk_id %h%
	sleep, 25
	Run, "%windir%\explorer.exe"

Hope this will help someone, and thank you @SaM for the wonderful thread! :slight_smile:

Friendly Websites