How can I execute AutoHotKey in a game

This is not for cheating. I am playing a point and click, single player game. The only goal I have is to move the cursor so it is visible on my TV.

My laptop is plugged into my TV screen, and only uses the TV screen (so despite having the potential of 2 screens, I only use 1).

An issue I have is, the mouse often gets lost outside the TV boundaries (I'm guessing Windows 10 still feels there are 2 monitors and despite not in use, still feels there is some value of my mouse being able to traverse something invisible to me).

So, a quick Google and I found I can use AutoHotKey to move the mouse into the middle of the screen

^!M::
CoordMode,Mouse,Screen
WinGetPos, winTopL_x, winTopL_y, width, height, A
winCenter_x := winTopL_x + width/2
winCenter_y := winTopL_y + height/2
;MouseMove, X, Y, 0 ; does not work with multi-monitor
DllCall("SetCursorPos", int, winCenter_x, int, winCenter_y)
;Tooltip winTopL_x:%winTopL_x% winTopL_y:%winTopL_y% winCenter_x:%winCenter_x% winCenter_y:%winCenter_y%

Source

However, when I'm playing a game and execute the shortcut, it does not move the mouse. When I'm out of the game, it works as expected.

Is there a way to move the mouse into the middle of the screen from within a game?

6

2 Answers

Some games intercept keyboard and mouse events at a very low level, so they will get them before AutoHotKey. You should look for another solution for such games. Note also that using AutoHotKey can get you banned in some games.

One possibility would be to disable the primary monitor in Windows. This would avoid the cursor going into that monitor, keeping it all in the second monitor.

Two methods for doing that:

  • Use the keyboard shortcutWin+Pand select "Second screen only".

  • Open Settings > Display, select the primary monitor and use the drop-down menu to select "Disconnect this display".

I have one small hesitation with my advice: I can't test because I don't have multiple monitors, so cannot be sure that Windows will let you disable the primary monitor.

3

You can use Dual Monitor Tools to restrict mouse movement.

I have used it in the past to restrict mouse movement in monitors. Some games dont have the ability to lock the mouse cursor to the playable area. This tool can fix that.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like