I need to write a script to make the active window always on top, but all the examples are for AutoHotKey v1. How can I do this with AHK v2?
^space::
{
WinSetAlwaysOnTop -1, "A"
}
This script uses the WinSetAlwaysOnTop
method to accomplish its goal. It takes several parameters, but not all of them are mandatory. -1
tells the function to toggle the setting to the opposite of whatever it was (e.g. OFF --> ON), and "A"
tells it to use the currently active window (whichever window has focus). You can also pass it the name of a specific window, like "Calculator"
.
Here are some links to the relevant documentation: