On my own computers at home, I have been running Linux since about 1999. One of the things that I really liked directly from the beginning of using Linux was that under X, I could move any window by holding the ALT button on the keyboard and then click anywhere in the window and drag it to the position I wanted.

This unlike Windows, where I have to always drag a window by clicking somewhere in the title bar. When I started working at Paragon Decision Technology (makers of AIMMS), I had to start working with a Windows laptop as our software is windows only for a big part (at least developing projects requires a windows version of AIMMS).

I did some searching and did find a couple of programs/plugins that were able to achieve the move-window-by-dragging-anywhere in-the-window, but none of them were exactly what I needed. After some time, I ran into the program AutoHotkey.

AutoHotkeyThis is an extremely powerful piece of software that allows you to do all kinds of cool things.

Currently I use it basically for two things:

  • Startup/Activate programs. E.g. if I press the keyboard shortcut Win-o, the Outlook window will be activated if Outlook was running, or Outlook is started otherwise. This can be achieved with the following piece of AutoHotkey script:
    #o:: SetTitleMatchMode 2 IfWinExist - Microsoft Outlook WinActivate else { Run outlook } SetTitleMatchMode 1 return


    - The earlier mentioned move-window-by-dragging-anywhere in-the-window feature. This can be achieved with the following AutoHotkey script:
    ; Note: From now on whenever you run AutoHotkey directly, this script ; will be loaded. So feel free to customize it to suit your needs.   ; Please read the QUICK-START TUTORIAL near the top of the help file. ; It explains how to perform common automation tasks such as sending ; keystrokes and mouse clicks. It also explains more about hotkeys.   !LButton:: CoordMode, Mouse ; Switch to screen/absolute coordinates. MouseGetPos, EWDMouseStartX, EWDMouseStartY, EWDMouseWin WinGetPos, EWDOriginalPosX, EWDOriginalPosY,,, ahkid %EWDMouseWin% WinGet, EWDWinState, MinMax, ahkid %EWDMouseWin% if EWDWinState = 0 ; Only if the window isn't maximized SetTimer, EWDWatchMouse, 10 ; Track the mouse as the user drags it. return   EWDWatchMouse: GetKeyState, EWDLButtonState, LButton, P if EWDLButtonState = U ; Button has been released, so drag is complete. { SetTimer, EWDWatchMouse, off return } GetKeyState, EWDEscapeState, Escape, P if EWDEscapeState = D ; Escape has been pressed, so drag is cancelled. { SetTimer, EWDWatchMouse, off WinMove, ahkid %EWDMouseWin%,, %EWDOriginalPosX%, %EWDOriginalPosY% return } ; Otherwise, reposition the window to match the change in mouse coordinates ; caused by the user having dragged the mouse: CoordMode, Mouse MouseGetPos, EWDMouseX, EWDMouseY WinGetPos, EWDWinX, EWDWinY,,, ahkid %EWDMouseWin% SetWinDelay, -1 ; Makes the below move faster/smoother. WinMove, ahkid %EWDMouseWin%,, EWDWinX + EWDMouseX - EWDMouseStartX, EWDWinY + EWDMouseY - EWDMouseStartY EWDMouseStartX := EWDMouseX ; Update for the next timer-call to this subroutine. EWDMouseStartY := EWD_MouseY return

    The best part about the window movement part is that it even works on windows that are partially behind modal dialogs. Normally, when an application is showing a modal dialog, you cannot move the underlying window because you must first close the modal dialog. With the above script, this restriction does not apply anymore.

    These two examples are just scratching the possibilities of AutoHotkey, but they have made my life a lot easier!

    If you have any great AutoHotkey scripts that made your life easier, please share them via a comment!