Moving the mouse to a corner of the screen triggers a command/s. Use modifier keys -- Alt, Shift, Control -- for additional commands. With modifier keys, commands are triggered when the modifier key is released.
This script is meant to be modified by the user for individual needs. I've included some examples of use. When using the script, make sure you watch your mouse placement to avoid accidentally triggering a Hot Corner. You might consider using a Hot Corner only with modifier keys if you frequently put your mouse near a corner during regular computer use.
Please post your comments or suggestions for improvement. Thanks.
; Hot Corners by Hotfoot ; September 16, 2005 ; ; Activation: Move the mouse to different corners of the ; screen to trigger commands. The mouse is moved to the ; center of the screen before triggering the command to ; prevent triggering the command multiple times. If you want ; the mouse to be moved to a specific position after ; triggering a Hot Corner, modify the MouseMove position. ; If you want a command to be repeatedly triggered, ; remove the MouseMove command. It is possible to ; trigger multiple Hot Corners if you want by setting ; the mouse to move to a different Hot Corner after ; execution of one Hot Corner. ; ; Commands: Example commands are shown below. Hold down ; Shift, Control, or Alt keys for additional commands. ; Modify them for your needs. ; Timer to check mouse position SetTimer, CheckMouse, 300 ; Top Left Corner: ; without keys: (example of repeating command) ; with Control key: Show Desktop command ; with Alt key: (add your own command) ; with Shift key: (add your own command) ; ; Top Right Corner: ; without keys: Minimize window, give focus to next window ; with Control key: (add your own command) ; with Alt key: (add your own command) ; with Shift key: (add your own command) ; ; Bottom Left Corner: ; without keys: Close window ; with Control key: (add your own command) ; with Alt key: (add your own command) ; with Shift key: (add your own command) ; ; Bottom Right Corner: ; without keys: Left Mouse Click after 2 second delay ; with Control key: (add your own command) ; with Alt key: (add your own command) ; with Shift key: (add your own command) #Persistent #SingleInstance force WinGetPos,,,Xmax,Ymax,ahk_class Progman ; get desktop size Xcenter := Xmax/2 ; Calculate center of screen Ycenter := Ymax/2 T = 4 ; adjust tolerance value if desired Xmax := Xmax - T ; allow tolerance to mouse corner activation position Ymax := Ymax - T CheckMouse: ; check mouse position CoordMode, Mouse, Screen MouseGetPos, MouseX, MouseY GetKeyState, SState, Shift GetKeyState, AState, Alt GetKeyState, CState, Control ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Commands for top left corner ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if (MouseY < T and MouseX < T and CState = "U" and AState = "U" and SState = "U") { SoundBeep, 100, 10 SplashTextOn,,,Hot Corner Triggered Sleep,500 SplashTextOff } if (MouseY < T and MouseX < T and CState = "D") { MouseMove, Xcenter, Ycenter KeyWait, Control send,#d } if (MouseY < T and MouseX < T and AState = "D") { MouseMove, Xcenter, Ycenter KeyWait, Alt Msgbox, Alt and Top Left } if (MouseY < T and MouseX < T and SState = "D") { MouseMove, Xcenter, Ycenter KeyWait, Shift Msgbox, Shift and Top Left } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Commands for top right corner ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if (MouseY < T and MouseX > Xmax and CState = "U" and AState = "U" and SState = "U") { MouseMove, Xcenter, Ycenter WinMinimize, A Gosub, ActNextWindow } if (MouseY < T and MouseX > Xmax and CState = "D") { MouseMove, Xcenter, Ycenter Keywait, Control Msgbox, Control and Top Right } if (MouseY < T and MouseX > Xmax and AState = "D") { MouseMove, Xcenter, Ycenter Keywait, Alt Msgbox, Alt and Top Right } if (MouseY < T and MouseX > Xmax and SState = "D") { MouseMove, Xcenter, Ycenter Keywait, Shift Msgbox, Shift and Top Right } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Commands for bottom left corner ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if (MouseY > Ymax and MouseX < T and CState = "U" and AState = "U" and SState = "U") { MouseMove, Xcenter, Ycenter Msgbox, 4,, Close window? IfMsgbox, Yes { WinClose,A } } if (MouseY > Ymax and MouseX < T and CState = "D") { MouseMove, Xcenter, Ycenter Keywait, Control Msgbox, Control and Bottom Left } if (MouseY > Ymax and MouseX < T and AState = "D") { MouseMove, Xcenter, Ycenter Keywait, Alt Msgbox, Alt and Bottom Left } if (MouseY > Ymax and MouseX < T and SState = "D") { MouseMove, Xcenter, Ycenter Keywait, Shift Msgbox, Shift and Bottom Left } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Commands for bottom right corner ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if (MouseY > Ymax and MouseX > Xmax and CState = "U" and AState = "U" and SState = "U") { MouseMove, Xcenter, Ycenter SplashTextOn,,,Left Click where? sleep,2000 SoundBeep, 100, 10 ; Audio signal MouseClick,left SplashTextOff } if (MouseY > Ymax and MouseX > XMax and CState = "D") { MouseMove, Xcenter, Ycenter Keywait, Control Msgbox, Control and Bottom Right } if (MouseY > Ymax and MouseX > XMax and AState = "D") { MouseMove, Xcenter, Ycenter Keywait, Alt Msgbox, Alt and Bottom Right } if (MouseY > Ymax and MouseX > XMax and SState = "D") { MouseMove, Xcenter, Ycenter Keywait, Shift Msgbox, Shift and Bottom Right } Return ActNextWindow: ; Get windows list and give focus to the top window WinGet, WindowList, List List = Loop %WindowList% { WinUID := WindowList%A_Index% WinGetTitle, WinTitle, ahk_id %WinUID% If WinTitle <> Break } WinActivate, ahk_id %WinUID% Return