; ; AutoHotkey Version: 1.x ; Language: English #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ; ---------------------------------------------------------------------------------------------------------------- ; Set the X coordinate at which you wish to block the mouse ; ---------------------------------------------------------------------------------------------------------------- BlockPosition=1918 ; Change this to the X coordinate you want to use. ; ---------------------------------------------------------------------------------------------------------------- ; Get the coordinates of the mouse ; ---------------------------------------------------------------------------------------------------------------- SetTimer, WatchCursor, 5 SetMouseDelay, 0 return WatchCursor: CoordMode, Mouse, Screen MouseGetPos, xpos, ypos ; ToolTip, x: %xpos%`ny: %ypos% ; Uncomment this line to see the screen coodinates ; ---------------------------------------------------------------------------------------------------------------- ; Constrain the mouse based on the x coordinate ; ---------------------------------------------------------------------------------------------------------------- if (xpos > BlockPosition) { BlockInput, On MouseMove, %BlockPosition%, %ypos%, 0 BlockInput, Off } Return ; ---------------------------------------------------------------------------------------------------------------- ; Hotkey to exit the script ; ---------------------------------------------------------------------------------------------------------------- ^+!F2:: ; Comment out these lines with a semicolon if you don't want this hotkey xpos= ypos= ExitApp Return