Saturday, May 22, 2010

Focus-follows-mouse in Windows (AutoHotKey)

This AutoHotKey code gives you focus-follows-mouse behavior: whatever window the mouse is over has "focus" (keys pressed are sent here). This lets you select a window faster than alt-tabbing though all the options. This script does not raise the window, so you can type in part of a window that is still partially covered (this comes in handy more often than you might think).

Thanks to sooyke, who posted it here.


~ScrollLock::

SLStatus := GetKeyState("ScrollLock", "T")
SPI_SETACTIVEWINDOWTRACKING = 0x1001
SPIF_UPDATEINIFILE = 1
SPIF_SENDCHANGE = 2
DllCall("SystemParametersInfo",UInt,SPI_SETACTIVEWINDOWTRACKING,UInt,0,UInt,SLStatus,UInt,SPIF_UPDATEINIFILE | SPIF_SENDCHANGE)
return

No comments: