1 simple way to keep a window always on top in Windows

I’m not going to waste any time on this; let me show you how to force a window to be always on top.

Go to http://www.autohotkey.com and download the application.

AutoHotkey is a reputable program that lets you create scripts and macros for your desktop You can remap keys and define specific hotkeys for your mouse and keyboard or even create text completion strings. (For example, ::btw:: becomes by the way)

There’s loads of stuff you can do with it but for now we’re just going to use it to lock a specific window on top of all your other windows.

When the installer pops on the screen, keep all the defaults and click Install.

AutoHotkey setup

Launch the app.  The icon is a green square with a white H in the center.  If you can’t find it, just hit the Windows Logo key on your keyboard and type in:

autohotkey

Launching Autohotkey

Now it’s time for the fun part.

The first time you launch, it’ll ask you for permission to create a sample script.  Click Yes or else AutoHotkey will automatically close.

Create autohotkey sample script

A window will open in a file called AutoHotkey.ahk.  This is a sample script that we’re going to replace with our always on top code.

Select all the text and delete it.

Autohotkey.ahk default script

Now paste in the following code and save the file.

^SPACE::  Winset, Alwaysontop, , A

Autohotkey always top script

I know the text looks weird so let me break it down real fast:

The first part, ^SPACE:: means trigger the action by pressing: Ctrl + Space.

But wait, how did I know that? It turns out that AutoHotkey has a nice reference that matches major symbols to keys.  Give it a quick read and I promise you’ll feel more comfortable with the AutoHotkey syntax.

For example, if you wanted to change the key trigger from Ctrl + Space to Alt + Space you would change the script beginning to !SPACE:: 

Just make sure you don’t override any existing keyboard shortcuts that you want to keep.

Okay, so let’s continue looking at the script:

Winset

The Winset command is perfect for Always on top because it lets you change the behavior of a specific window.

, AlwaysOnTop

Next we follow that with an attribute, value pair.  Since we want to force the window on top of everything else, we simply specify the AlwaysOnTop attribute.

, , A

This part looks a little funny but that’s because we’re leaving the value portion blank.  By default, if you omit the AlwaysOnTop value it’ll default to TOGGLE.  So each time we press Ctrl + Space the window will toggle from being forced on top to being normal.

The A means apply the settings to the Active Window.

Here’s the script again:

^SPACE::  Winset, Alwaysontop, , A

Alright, now make sure you save the script then look for the AutoHotKey “H” icon in the system tray.

Right click that and choose Reload This Script.

Reload Autohotkey script

Now go find a Window you want to force on top and press Ctrl + Space.

Let’s see… I’m going to force Outlook 2013 to be always on top…

Always on top

Nice!

Now you can keep your password manager, Chrome, or video player on top of all your other windows with a simple and 100% configurable keystroke combo.  And do you know the nicest part of it all?

It takes up virtual zero system resources.  AutoHotkey won’t slow down your computer.

AutohotKey takes up zero space

Oh yeah, and remember: if you ever forget the hotkey combination, you can always right click the AutoHotkey icon in the tray and choose Edit Script from the context menu.

That’s all – thanks for reading!

About

Connect with Vonnie on Twitter

Posted in Windows, Windows 7, Windows 8, Windows 8.1 Tagged with: ,
  • Christopher Talbot

    This doesn’t work when it comes to full screen applications or anything Metro related, any way around this?

  • Sanjaya

    Thank you…

  • Luke Marshall

    Dude I just added it works great for what i need it for, toggle works and every thing. I got turned on to autohot key about 2 years ago and I’ve used it everyday since . by far the most useful tool i have >

    ^!p::
    Send {PrintScreen}
    Run mspaint
    Sleep, 2000
    IfWinExist Untitled – Paint
    {
    WinActivate
    Send, {CTRLDOWN}v{CTRLUP}
    return
    }
    else
    {
    MsgBox No paint found.
    }
    return

    ^!L::
    Send {PrintScreen}
    Run mspaint
    Sleep, 2000
    IfWinExist Untitled – Paint
    {
    WinActivate
    Send, {CTRLDOWN}v{CTRLUP}
    Sleep, 1000
    Send, {F12}
    Sleep, 1000
    Send, Screen Shot
    return
    }
    else
    {
    MsgBox No paint found.
    }
    return

    Great screen grab code