- 1. Intro
- a. How I made this tool
- 2. Downloading and “installing” AOT
- a. Download and install
- b. Some extra bit of configuration
- 3. Writing the tool by yourself.
- a. Installing AutoHotKey
- b. Writing the code.
- 3. Compiling the .exe
1. Intro
This is a short one. I found this neat trick the other day while browsing the internet, and decided to implement it. I then started using it a lot more than I thought I would! “Always On Top” is a very small utility based on the AutoHotkey script (huge article on that coming someday) which basically enables you to pin any window to the “top” of your screen. Meaning any other windows will always move and be behind it. If you’re familiar with Pureref, you’ve probably used this setting before. The thing is, only some apps come with this setting. For the rest of your windows, here’s this tool!
a. How I made this tool
As I said before, this tool is based on an AutoHotkey script. It’s barely one line of code:
^SPACE:: Winset, Alwaysontop, , A
Without going into too much detail, AutoHotKey is a scripting language that lets you create lots of useful shortcuts, actions and macros to do things fast with your computer. I will get a lot more into detail in the future, and I think everyone is going to love it as much as I do.
After writing the code, I just compiled the above line of code into a .exe file so that you can easily run it and then added a cute pin icon to it. That’s literally it.
2. Downloading and “installing” AOT
a. Download and install
If you don’t want to create this tool yourself, you can simply download it from here. Just unzip the downloaded file and save the tool wherever you want.
You can double click to run it, and this same pin icon with appear in your menu bar. You can now just hit CTRL+SPACE to pin a window to top. Press CTRL+SPACE again while having the same window active to unpin.
b. Some extra bit of configuration
So here’s another cool tip inside this tip (tipcetion!). There is a way you can pick certain programs and apps to run automatically when you turn on your PC, so you don’t have to worry about running them time and time again when you need them.
To do this, you need to press the Windows key and R at the same time. (WIN+R). The Run window dialog will pop up. Then type shell:startup and hit OK.
This will open a folder where you can copy any links and shortcuts to the apps you want your PC to run when it starts up. Just drag a shortcut (or the entire, small app itself) to this folder, and you’re done! The app will run when you turn on your PC.
3. Writing the tool by yourself.
So this is where it gets fun! I wanted to write this optional section for those of you who are a bit wary of just downloading any random guys’ (hey!) executable file. I understand your hesitation and I accept it. I won’t dig into much detail, but you can always reach out to me in social media if you have any questions or something isn’t working.
a. Installing AutoHotKey
To write this app, you will need to install AutoHotKey. It’s a super cool app and I will one day explain why, but for now you just need it to code and compile this tool. You’re free to uninstall it once you’re done.
Download and install AHK.
b. Writing the code.
Now you need to create a new text document (any text editor will work) just to write our code. On the blank document, just copy paste this:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^SPACE:: Winset, Alwaysontop, , A
Return
The first few lines are just default instructions for AutoHotkey to work properly, and the bottom two are the tool and a “Return” command so that it stops reading code when it gets there. I’m not even sure that last line is needed but I’m a self-taught pseudo-coder so I tend to overdo these things.
That’s literally it! Now save this text file as anything you want, with the extension “.ahk” This is important so that AutoHotKey recognises the file. Since you have AutoHotKey installed, you can now double-click this .ahk file to open the tool, and you’re good to go! Before making the .exe, you can right click and Edit the .ahk file to change the shortcut or test new things.
3. Compiling the .exe
With AutoHotKey still installed, you can right click on the .ahk file you just made, and you will see a list of options. Pick “Compile Executable (GUI)”. A dialogue will open up and will ask you where to save the .exe, and if you want any custom icons on it. Once you’ve saved the .exe and tested that it works, you’re free to uninstall AutoHotKey if you please. You can now follow the instructions on part 2.b of this article.