AutoHotkey In Easy Way

AutoHotkey In Easy Way

- 4 mins

Working Smarter, Not Harder is one of the most important aspects of daily job.

And in order to help you with that, I’ll introduce you to one of the most crucial yet sometimes overlooked keyboard functions.

Therefore, you can save time using this function even if you are a regular user or work as a developer or programmer and have common syntax, or if you work in marketing and write a lot of emails every day.


You may create shortcut keystrokes with AutoHotKey, a free program.

First and foremost, you must download the program from this page.

Second, you need an editor or IDE to create or edit new scripts, and SciTE is among the easiest to use.

So, I`ll suppose you already download and installed those two tools. I’m going to assume that you have already downloaded and set up those two tools.

The first step is to build your first script by doing a simple right-click and selecting New AutoHotKey from the context menu, as demonstrated below.

image

The new file with the extension “.ahk” will be created in this phase. To edit it, right-click on it. SciTE will be the default editor, and it already contains some text.

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

The next crucial action you must take is to add the following two lines:

#SingleInstance, Force ;Only launch 1 instenace of this script.
#Persistent ;Will keeping it running.

In order for this script to execute on every Windows logon, you must now place it in a well-known folder and leave it there. We will create a shortcut to this file and copy it to the Windows Startup folder.

Using the run command (Windows key + r), open the Startup folder directory, type shell:startup, and then paste the script there.

As a result, up to now, we have only prepared the tool—not created any hot keys.

Now that we know when to create new hot keys utilizing (Ctrl, Shift, and alt), we need to develop some tips to help us remember.

;~ ! Alt key
;~ # windows key
;~ + shift key
;~ ^ control key

As you can see, I marked it as a comment by using a semicolon.

For the time being, we must create the first hot key, which will specify the hot key to launch the script each time we need to examine or update the code.

My own hot key that I use for that is

^e::Edit ;This will edit the script.

Next, you must use (Ctrl + s) to save the script after making any changes.

Furthermore, in order for the modifications to take effect, we must reload the script; therefore, we will also build a hot key for that reason.

^r::Reload ;This will reload the script.

image


We were then prepared to create our own hot keys.

I’ll give you two examples to get you started, but you can also create your own or look through the autohotkey manual to see what else this program can do for you.

Assume that we need to create a hot key for my daily emails, which I write on several platforms and forms.

:o:ema::emad@example.com ; the "o" between colon prevent space after sentence.

Now, it will look like this if I have a sentence that needs to be written and it involves symbols.

:or:thx::It`s okay, I appreciate your time.

As you can see, I added two characters (o to prevent creating whitespace after the last word and r to include any symbol) between the first colon. This is a necessary addition if you write syntax as a programmer.

As you can see, I added two characters (o to prevent creating whitespace after the last word and r to include any symbol) between the first colon. This is a necessary addition if you write syntax as a programmer.

We have now reached the conclusion; if you need any additional assistance, view the documentation by clicking this link

Emad Youssef

Emad Youssef

Sr.Systems Engineer | Pentester | Bug Hunter