Make a autohotkey script that will move mouse from the middle of monitor 1 to middle of…
- User
Make a autohotkey script that will move mouse from the middle of monitor 1 to middle of monitor 2. Both monitors are 1920x1080
- Assistant
To create an AutoHotkey script that moves the mouse from the middle of monitor 1 to the middle of monitor 2, you'll need to consider the coordinates for both monitors, assuming they are side by side. The resolution for each monitor is 1920x1080, and if monitor 1 is the primary monitor and located on the left, your screen coordinates for the two monitors are as follows:
- Middle of monitor 1: (960, 540)
- Middle of monitor 2: (2880, 540) [1920 (width of monitor 1) + 960 (half of monitor 2's width)]
Here is a simple AutoHotkey script to move the mouse from the middle of monitor 1 to the middle of monitor 2:
#Persistent ; Keep the script running #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases SendMode Input ; Recommended for newer scripts due to its superior speed and reliability SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory ; Hotkey to move the mouse from the middle of monitor 1 to the middle of monitor 2 ^m:: ; Move to middle of monitor 1 MouseMove, 960, 540 Sleep, 500 ; Optional: pause for half a second ; Move to middle of monitor 2 MouseMove, 2880, 540 return - User
Make a autohotkey script that will move mouse from the middle of monitor 1 to middle of monitor 2. Monitor 2 is on the left side. Both monitors are 1920x1080
- Assistant
If monitor 2 is on the left side of monitor 1 and both monitors have a resolution of 1920x1080, the screen coordinates will be slightly different:
- Middle of monitor 1: (960, 540)
- Middle of monitor 2: (-960, 540) [since monitor 2 is on the left, you subtract 960 (half of monitor 2's width) from 0]
Here's a script that uses AutoHotkey to move the mouse from the middle of monitor 1 to the middle of monitor 2. The hotkey
Ctrl + Mis used to activate this movement.#Persistent ; Keep the script running #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases SendMode Input ; Recommended for newer scripts due to its superior speed and reliability SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory ; Hotkey to move the mouse from the middle of monitor 1 to the middle of monitor 2 ^m:: ; Move to middle of monitor 1 MouseMove, 960, 540 Sleep, 500 ; Optional: pause for half a second ; Move to middle of monitor 2 MouseMove, -960, 540 return - User
make the script run when i click f8
- Assistant
Sure, to modify the script so that it runs when you press the
F8key instead ofCtrl + M, you just need to change the hotkey definition at the start of the script. Here is the updated AutoHotkey script:#Persistent ; Keep the script running #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases SendMode Input ; Recommended for newer scripts due to its superior speed and reliability SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory ; Hotkey to move the mouse from the middle of monitor 1 to the middle of monitor 2 F8:: ; Move to middle of monitor 1 MouseMove, 960, 540 Sleep, 500 ; Optional: pause for half a second ; Move to middle of monitor 2 MouseMove, -960, 540 returnTo use this modified script:
- Copy the code into a text file.
- Save the file with a
.ahkextension, such asMoveMouse.ahk. - Double-click the
.ahkfile to execute the script. - Press
F8to move the mouse from the middle of monitor 1 to the middle of monitor 2.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.