Home Tech 19 Of The Best AutoHotKey Script To Make Your Life Easier

19 Of The Best AutoHotKey Script To Make Your Life Easier

0

AutoHotkey(AHK) is open-source software, initially designed to provide users with custom shortcuts but now it is converted into full-fledged automation software.

It was built on and for Microsoft’s Windows platform. The AutoHotKey to override the default control key commands prescribed by the Windows with its Emacs equivalent.

What is HotKey?

Before learning the dynamics and intricacy of AutoHotkey we should first learn “what is hotkey?”.

Hotkeys are a set of keys that allow the user to quickly perform a specific task. They are often referred to as shortcuts. For example, Alt + F4 is used t close a window.

How to Download and Install AutoHotKey Script?

To download the AutoHotKey click here

Then, click on “DOWNLOAD” and choose the current version.

Now click the downloaded application to install it on your computer. Do Express Installation and you are good to go.

To use it, you ought to create an AutoHotKey shortcut. 

autohotkey scripts

You need either the Notepad or any other text editor to write a program and thereafter, you can run it through the AutoHotKey application. 

If you right-click the AutoHotKey application you will a list of different features such as:-

autohotkey scripts

  • Run Script is used to run your script with AutoHotKey’s runtime.
  • Compile Script, will compile files which contain ATH interpreter and scripts.
  • Edit Script is used to create a file via a text editor. 

Note: When you click “edit script” your default text editor will pop-up which usually is a notepad.

To end AutoHotKey’s functioning you need to right-click the green button from your taskbar and the appeared list click on “exit”. It will end your program.

Features of AutoHotKey:-

Best AutoHotKey Script To Make Your Life Easier

As mentioned earlier AutoHotKey now is not just a “custom shortcut creating” application. It has different functions, features, and uses. Let’s look at some of its uses.

  • They can be used to redo your keyboard orders such as QUERTY, Dvorak, etc. 
  • AutoHotKey enables the user to add a signature to an email, message, etc.
  • They allow the user to use a keyboard or a joystick as a mouse cursor.
  • They can make a platform to run Automatic Repetitive Tasks.
  • If you want to add particular punctuation or symbol not available on your keyboard you can use AutoHotKey.
  • To change previously assigned shortcuts or create new shortcuts.
  • Schedule tasks at a particular time.

How to use AutoHotKey:-

AutoHotkey can be used for many things in this section we are going to create, compile, and run a few of the AutoHotKey tasks.

Keys equivalent in AutoHotkey:-

To write a program in AutoHotKey scripts you need to learn the hotkey equivalents. These are the keywords that you can use instead of the keys present in your keyboard. To do that you need to need first check all the equivalents from the official website of AutoHotkey.

Here in this subsection, I am going to explain a few of the key hotkeys.

  1.  # is used as a key equivalent of windows.
  2. ! Is used as a key equivalent of Alt.
  3. ^ is used as a key equivalent of Ctrl
  4. + is used as ky equivalent of Shift
  5. & is used to combine two keys or mouse into a custom hotkey.
  6. < is used to trigger the left key. For example, <^a will trigger the ctrl button but the left on will get triggered.
  7. > is used to trigger the right key.
  8. <^>! Is used as a key equivalent of AltGr(if your keyboard has AltGr in place of Alt)

For in-depth detail see AutoHotKey’s official website mentioned earlier.

Best AutoHotKey Scripts: Our Top Pick 👌👌

1. Use AutoHotKey to launch Chrome

As mentioned earlier AutoHotKey is used to create shortcuts that will save the user’s time.

Let’s use AutoHotKey to launch Chrome. We are going to make “Windows + A” a new shortcut for this.

Step 1: Right-click on the “AutoHotKey” icon and click on “edit script”

Step 2: A text editor will open with few lines of codes written in it.

Step 3: Without altering then you need to type the code written below.

#a::

Run Chrome

return

Step 4: Now save the text and run the application. By right-clicking the application and selecting “Run Script”.

Step 5: After clicking “Run script” you will see an “H” in green color on your taskbar which confirms that your code is running in the background.

Step 6: Click “Windows + A”  and your chrome will be launched. 

Now let us understand the code in detail. Let us understand it line-by-line.

“#a::”: This line defines the hotkey. ‘#’ is used as a short form of Windows and ‘a’ is a button assigned to be used as a shortcut with the windows key. The Double colon “::” is used to signify the dawn of an action block.

Now let us examine the second line which is giving a command to launch Chrome by the “Run Chrome” line. 

The last line “return” is used to terminate the code. “Return” will always be written at the end of code you can have any number of actions before it.

So, this was the basic command which you can use to start with the AutoHotKey.

2. Use AutoHotKey to make an AutoCorrect program

If you are a typist or an article writer like me then you might want to use autocorrect software. How good it would be if you can create one for yourself, AutoHotKey allows you to do that.

Now you have to download the AutoHotkey script from here. Just go the website select the code, copy and paste it to a notepad file and then save it using “.ahk” extension. 

And you are good to go, enjoy your custom made Autocorrect tool.

3. Use AutoHotkey script to Launch Website quickly

There are a few websites that you use a lot, for some of you it might be Google, Facebook, Instagram, etc. What if you can create a shortcut that will do that for you. So, I am going to use “Ctrl + Shift + R” to do that with the help of AutoHotKey script.

Use the script prescribed below to do open your favorite website with just a few keyboard strokes.

; Launch Technicalustad

^+r::Run “www.technicalustad.com” ; use ctrl+Shift+r

return

Just save the file with a “.ahk” extension and you are good to go. You don’t have to write the exact code this was just an example. You can use any other key and their assigned symbols.

4. Use AutoHotkey to reassign Function Keys

I don’t know about you but I do not use any functional key other than “F5” which is used to refresh the screen. With the help of AutoHotKey script, you can reassign these function keys to make them useful. You can do dozens of things with them like launching a folder, launching a website, etc.

Now let’s reassign F4 as a button to Launch the Games folder stored on my laptop.

To do that you have to first copy the location of that folder. Afterward, write this program.

;Launch games

F4::Run “D:\games”

return

Now your functions are not just there to glorify your keyboard they have some work as well.

You may like to read our guide on How to Record your actions to automate repetitive tasks.

5. Use AutoHotKey Script to Move a folder Up in file explorer

If you wanted to move up a folder in a file explorer you were able to that in the previous versions of Windows, you just have to click the backspace and you are good to go. But in the advanced version of windows backspace is used to move back in history.

But with the help of AutoHotKey, we are going to give you some nostalgic feeling but differently. We are going to use your mouse’s middle button as a “move-up” button.

Here is the code that you need to write to do that.

; Click your Mouse’s middle button to move up in file explorer

#IfWinActive, ahk_class CabinetWClass

~MButton::Send !{Up} 

#IfWinActive

return

6. Use AutoHotKey Script to Adjust Volume

It is very annoying to grab your mouse and then go to the bottom of your screen and then adjust the mouse(if your keyboard does not have the mouse adjusting button).

We can use AutoHotKey script to create a custom button or ourselves self which will allow us to have a button that can control your mouse’s volume. 

To do that follow this autohotkey script:-

; Custom volume rocker

+1:: Send {Volume_Up} ;shift + 1

+2:: Send {Volume_Down} ;shift + 2

break::Send {Volume_Mute} ; Break key mutes

return

Note: It is advised to use Number + and – for increasing and decreasing the volume since I do not have those buttons that’s why I used them.

7. Use AutoHotKey Script to remap Shift

Well, this might not be of great use to you but let’s still give it a shot. So, we are going to swap the shift with capslock. To do that follow the script prescribed below:-

; Shift acts as Capslock

Shift::Capslock

Return

8. Use AutoHotKey Script to remap Capslock

After swapping Capslock for the shift, we are going to the vice-versa. To remap the Capslock button use the script prescribed below.

; Capslock acts as Shift

Capslock::Shift

Return

As you can there is not much of a difference between two codes, we have just swapped the entities and you will be able to use capslock as the shift.

9. Use AutoHotKey to Show or Hide known file extension

So, you have downloaded something that is not sure whether it is pdf or not. If you want to check the extension of that file you should have an extension checker. We are going to create one with the help of AutoHotKey script.

Type this script and save it with “.ahk” extension.

; WINDOWS KEY + Y TOGGLES FILE EXTENSIONS

#y::

RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt

If HiddenFiles_Status = 1 

RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0

Else 

RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1

WinGetClass, eh_Class,A

If (eh_Class = “#32770” OR A_OSVersion = “WIN_VISTA”)

send, {F5}

Else PostMessage, 0x111, 28931,,, A

Return

Now just use Windows + Y and you are good to go.

10. Use AutoHotKey to Quickly view or hide hidden files

Hidden files have this nack of becoming translucent, which will eventually clutter up your work. If you want to control their visibility you can do that with the help of this script.

; WINDOWS KEY + H TOGGLES HIDDEN FILES

#h::

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

Else 

RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2

WinGetClass, eh_Class,A

If (eh_Class = “#32770” OR A_OSVersion = “WIN_VISTA”)

send, {F5}

Else PostMessage, 0x111, 28931,,, A

Return

Whenever you want to either view or hide a hidden file, press Windows + H

11. Use AutoHotKey Script to disable Lock Keys

There are three Lock keys, Capslock, scroll lock, and Numbkey. Most of us do not use them. So, why not disable them. To disable Lock Keys use this script.

; Set Lock keys permanently

SetNumlockState, AlwaysOn

SetCapsLockState, AlwaysOff

SetScrollLockState, AlwaysOff

return

12. Use AutoHotKey Script to empty the Recycle bin

Let’s make clearing junk from the recycle bin as easy ever for you. To use AutoHotKey for clearing junk files you can use the following script.

; Empty trash

#Del::FileRecycleEmpty ; win + del

return

Now, whenever you want to clear the recycle bin just click “Windows + Delete” and you are good to go.

13. Use AutoHotKey Script to make a duplicate Chromebook search bar

A Chromebook comes with a search button that allows the user to search any highlighted line. If you don’t have a Chromebook and want to use that feature on your keyboard, you can do that via AutoHotKey. 

Here is the command by which you can imitate Chromebook’s search button. 

^+b:

 Send, ^b

 {

Sleep 50

 Run, http://www.google.com/search?q=%clipboard%

 Return

}

Just type this program in your text editor and save it with “.ahk” extension. Now, you just have to click “Ctrl + Shift + b”

14. Use AutoHotKey Script to keep a Window always on the top

If you are writing on a presentation consisting of 50 slides and out of nowhere your boss comes up to you asks you to replace a few hundreds of words from your ppt. Now, do not panic I got you covered just go open “find and replace” window and pin on top and screen and then thank me!

To do that, use the following script.

;select the desired program or window and press Ctrl + Space

^SPACE::

Winset, Alwaysontop, , A

Return

Now just select the desired window and click “Ctrl + Shift” to pin that particular window and you are good to go.

15. Use AutoHotKey Script to use the Numpad as a mouse

Even though you can use your keyboard as a mouse but it’s too complicated and slow. Therefore it is better to make an AutoHotkey script to convert your Numpad into a mouse. So, let’s do it.

Download the script from here

And you are golden.

16. Use AutoHotKey to suspend AutoHotkey

According to a lot of philosophers, you can not defeat anger with anger but here you can. I am going to teach you how you can temporarily suspend AutoHotKey via AutoHotKey.

There are moments when you need to stop your AutoHotKey while running a program. So, here is the script that you can use to stop AutoHotkey.

; Suspend AutoHotKey

#CapsLock::Suspend ; Win + CapsLock

return

Now just press Win + Capslock and you are good to go.

17. Use AutoHotkey Script to Paste into a command line

If you are a constant user of command prompt you might have already addressed this issue that the usual “Ctrl + V” does not work in it(before Windows 10). With the help of AutoHotKey, we will make sure that this shortcut works in the command prompt as well.

To do that, use the script written below:-

#IfWinActive ahk_class ConsoleWindowClass

^V::

SendInput {Raw}%clipboard%

return

#IfWinActive

Just save it with “.ahk” extension and you are good to go.

18. Use Autohotkey to do a lot more

Now that you know how it works, you might want to dig a little deeper into the world of Scripts to that, you should check the official AutoHotKey website.

It is not as difficult and complex as some of the other programming languages like python, java, etc. You just need to learn a few of its symbols and shortcuts and you are good to go.

Is AutoHotKey Safe?

AutoHotKey is another programming language and like other programming languages(java, C++, python, etc) it is vulnerable to Malware. So, there is some malware written in AutoHotKey script just like any other language. Therefore, you just need a good anti-virus or anti-malware to protect your script from hackers.

My Anti-virus is depicting AutoHotKey or its script as a malware, what should I do?

Look an AutoHotkey file is just a file at the end of the day. So, it can be infected by a virus or malware. But most of the time these notifications are fake, there is a high chance that your antivirus has mistaken it as a virus, which we call as a false positive.

If you want to confirm whether your program is infected or not, you can upload the script on online platforms such as Jotti or Virustotal. As they can scan the complete script or program and tell you whether your program is infected or not.

Afterward, if the program is safe and secure you should report the error to your Antivirus manufacturer as it will not only help you in the long run but it will also help other users and manufacturers as well.

If you are using compressed compile scripts such as UPX(default for AutoHotKey 1.0 but not 1.1) or MPRESS(optional for Autohotkey 1.1) then the chances of you receiving False Positive is very high. Because the default AutoHotKey installer comes without compressor, therefore, compiled scripts are compressed by default.

Could you get banned for using AutoHotKey scripts?

Using AutoHotKey will not get you banned because it is just another programming language. But a lot of us use AHK scripts to make cheat-codes of a game and whatnot. 

Here are the two most basic criteria for banning:-

1. The user should have broken the gaming rules. The manufacturer of a particular game has the right to ban any user, he doesn’t need a reason for that.

So, if you are using cheats in the game and the publisher gets to know about it, then there is a high chance that you might end up being banned from that particular game or a particular series of games. For example, if you have used cheats in FIFA 19 then you might get banned from all the seasons of FIFA.

2. Anti-Cheat software is one of the biggest enemies of gamers nowadays, as because of the advancement in Artificial Intelligence developers can easily depict the wrongdoing of their gamer because of anti-cheat software and block them.

So, AHK can not ensure that you will not get banned, as it was made for the legitimate purpose it is up to you how you want to use it. But if you are using  cheats in offline games or the games which do not have a good anti-cheat software then you might get away with AHK

AutoHotKey vs AutoIT:-

Both the AutoHotkey and Auto IT are scripting languages. They are very similar to each other. AutoIT was the source from which AutoHotKey was derived. They both are designed to work on Microsoft’s Windows platform.

If we compare both of their syntaxes you will see that AutoIt has a more structured format as compared to AutoHotKey(it depend on your taste).

But according to me, AutoIt is a bit more complex than AutoHotkey. AutoHotKey is more powerful than AutoIT as it manages hotkeys linked to simple actions better.

So, now the question which one is better for you? The answer depends on your need if you are going to create a full-fledged automation program then you might want to use AutoIT as it has a better structure.

On the other hand, if you are just creating a few shortcuts for your keyboard then AutoHotkey is better because of its simple coding.