How To Learn Autohotkey [2021] - Beginners Tutorial

My name is Anna Jensen let's, learn some auto hard key to download auto hotkey go to click, the green button called download take download cue inversion and autohotkey will download click it that will start the installer. Take express installation autohotkey is now installed. We can click exit to create your first script go to your desktop simply just right click anywhere. You want click, new click, also hotkey script.

This has now created an auto hotkey script with the name, new auto. Hotkey script feel free to change that name I'll, keep it. So our script is empty now and to edit it. We simply just right, click, click, edit script that will open up a notepad, and that could edit our code. We can use more advanced editors, however, I'll recommend you notepad to get started the code will be the same, and we will have no disturbing features around so let's, create a simple script that will change one word to another.

Whenever this script runs, you can see this as an auto replace function in. Auto hotkey, we will call it a hot string to recreate a heart string. Let me have a new line here we'll say, two colons. And then we will have the word that we want to get changed to something else that could be a h k like this. Then two more colons, and then we'll say, what word do we want to get a HK change to whenever we write it that could be auto hard key like this.

Then we just need to end our script. We do that with a return to save our script. We press CTRL, s, that's it. And let me just move this.

Icon up here. So in order to run this script, I just double-click on it. And to see that we actually have activated this script go down to your tray there's, nothing to see.

But if you click this up arrow, you'll see an auto hotkey logo with the name of our script. This one was called new auto hotkey script. So if you run a few different, scripts always rename your scripts. So we can easily identify them that's. It let's see that it works.

So right, click on your desktop, again, click, new click, new text. Document that will open up another notepad. So we have it here and let's say that right, a8, k, then space, the auto hotkey will come up a HK space. The auto hotkey will come up also if you write a HK and an inside will work or tab. That means this one works as default when we write an in character that is a space, an Center or tab. If we want to have it work without the end character that is whenever we write a HK. We want this to work.

Then we simply just go over here to our script and place a stereos. Between the two colons in order to update our script, we save it. We can either do it up in file save as of course, or simply just click CTRL. S, that has saved it. Now we can double-click the script here that will update the script. We will see that we get a warning. Yes, please keep updating it.

The script. Then it will work. So if I go to a new line here now, if I write a HK, it will immediately get changed to auto hard key that's quite clever. However, check this. If I write 1 AHK, it will not get changed.

That is because there's another letter in this word. So by default, it will not get changed say that we want this to get activated as well. We go over here to our asterisk. And then we type in the question mark that one will make it work.

Whenever we write AHK inside some other letters. So let's save the script CTRL. S, double click to activate. It clicks, yes, if we go over here, we say 1, AHK, that's, if you'll see that the HK gets changed to auto hotkey.

So we have combined these two properties. You can have. One of them or both of them, another important part of auto hard key that is hotkeys. A hotkey is simply just a key that you define. And whenever you press that key or a combination of keys, then the script will run, it will look like this. So let me delete the old script here that's it.

So for example, the shortcut for control is this hat here. And then I can say control q, so that one will be my combination. So whenever I press control q, I want my script to start that's it.

I press two colons, then I can. Go to a new line, always make new lines. Here, I'll just have a Sand some text into the active window. So I'll say, send then a comma, and then I'll have my text that could be is this video helping you then please give it a thumbs up that's it.

We can now save the script like this. We can double-click to update it. Then we go over here. And now when I press CTRL q, this text comes up you'll, see here it comes up. It comes up like that.

We can combine commands so say that we want this sends here that will send. The text to the active window, we will also like a message box. A measures box is a box that shows up on the screen. It will pause the script. So it's quite useful.

When we debug that is find errors in our script check that everything works. Let me show you so up here below the hotkey and above to send I'll say, msg box, again, a comma, and then I'll say, what will be in our message box? This could be this is the start like this. Then I press CTRL. S, I double-click the script to overwrite it that's it and.

Whenever I go over here, I press CTRL q, then this script will run. So let me show you CTRL q. Then the message box will show up and see that we don't get this message on yet. But when I click, ok, the text will get written.

Did you see that it added a new line? We can also launch applications say that I want to open up a specific application. I could add that to my script as well that will be with a run command, then a comma, and then I'll have to type in the path of that application.

But if it is a. Standard windows application, we can just type in the shortcut. So for example, if I type in call that will open up the calculator. So if I save it, I double-click to update I'll say, yes, then I press CTRL q, then you'll see that it opens up the calculator here. And then the message box come up. We'll click, ok. And you see nothing will happen here that is because this sends will send this text to the active window.

And because the active window is the calculator. Then nothing will happen in order to bring. The focus back to the notepad. So we can have another line written.

We simply just go to right before to send make a new line. Then we'll say, win, act, wait then we'll say, comma. And then we will have the title of the window that we want to activate. The title of this window is asterisk, new text, document notepad, so I'll just write it here as the risk, new text document notepad like this that's. It let's see how it works close down the calculator, save the script double click to update it. Then click, yes.

Now when I press control q, you'll see that the calculator will open here, I can do calculations this script will not start until I click here. I click, ok. And there you go. We have activated this window back. We could also open all sorts of other windows application, such as another instance of notepad, I'll, simply just change this to notepad do note that this is only work as I said with windows application, so I'll click, save double click it to update it like this press, CTRL q. And there you go.

We have. Opened up a notepad. So we'll finish here, let me go down here, let's say that we want to open up application that is not windows standard that could be WinRAR, then we'll need to find the path of that application. So if I go to my Windows folder, I'll go to the program files here, WinRAR, then I'll find the program that I want to open. I shift right, click, then I copy as path.

So if I wanted to have the rim right open, instead of the notepad, I simply just go up here and put in the path like this. So let's. Save the script CTRL. S, double click to update it and let's try to run. It CTRL q, you'll, see here that win run.

This will open let us close this one down, and we will have another line. So that's, how you open up both windows programs and custom programs. We can also run websites. So let's say that I instead of running a program here I would run a website. I simply just change what's in here with the website address. So that is ace TTP.

S, then I could take my website that is this one and let's see how that. Works so controller, save the script double click it. Yes, please, and then we'll start it with CTRL q.

So you'll, see here that this one opens up my website. And by the way you can join the auto hard key discord. I made one just click connect here and find the auto hotkey channel. That is where we talk about auto hard key and exchange solutions to problems.

Let me close this one down again, and we will have another line. Of course, say that we want this to open up in edge, say, micro, soft, edge, dot exit that. Is the exit file of the browser like this then we'll control, s, save it update the script like this. Then we can run it CTRL q.

And you will see that my website now opens up in edge, that's fine. Now, instead of these scripts has to be started with a double click like up here. We could have this script automatically started at windows startup. So in order to automatically start auto hard key scripts at windows startup. We simply just go to our start menu. Then we'll find a run so search for it or whatever. This one is called in your local language, click it to open it.

And then you go to shell startup so shell, colon startup, then we'll click, ok, that will open up a folder. This folder is having everything that needs to be started at windows startup. So if I copy this or move this script over here, this script will now automatically start at my windows' startup that is clever if I make some scripts that will help me in my daily job. I can just now start these scripts.

Thank you for watching. Do you want more? Auto hotkey check out my 80-minute auto hotkey guide to the left, or you can check out UiPath I'll recommend you do so because it's free, and it's very advanced. It can do all the things' auto hard key can and a lot more.

Dated : 27-Apr-2022

Leave Your Comment