Looking for a script that alters mouse input on a certain window only. Topic is solved

Ask gaming related questions
tobindax
Posts: 6
Joined: 21 Oct 2016, 07:02

Looking for a script that alters mouse input on a certain window only.

29 May 2017, 02:31

I want a script that does two simple things.

1. When you click in that window instead of LClick and RClick it sends letters "A" and "B" respectively (examples).

2. When you actually move the mouse in that window each of the 4 directions of movements are sent as letters "C", "D" (-x/+x) and "E", "F" (-y/+y) (again, letters are examples).

I realize the latter might be more daunting.
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Looking for a script that alters mouse input on a certain window only.  Topic is solved

29 May 2017, 10:11

Code: Select all

SetTitleMatchMode, 2
#IfWinActive, window title ; replace this with your window title
#Persistent

SetTimer, Timer1, 10

LButton::Send a
RButton::Send b

Timer1:
Padding = 25 ; number of pixels the mouse must be moved to activate the script.  
MouseGetPos, MouseX, MouseY
If (MouseX <> LastX && MouseY <> LastY)
{
	If (MouseX > LastX + Padding)
	{
		Send d
	}
	Else If (MouseX < LastX - Padding)
	{
		send c
	}
	If (MouseY > LastY + Padding)
	{
		Send f
	}
	Else If (MouseY < LastY - Padding)
	{
		send e
	}
	LastX := MouseX
	LastY := MouseY
}
Return
tobindax
Posts: 6
Joined: 21 Oct 2016, 07:02

Re: Looking for a script that alters mouse input on a certain window only.

30 May 2017, 01:36

I thank you. I wonder if the mouse part is simulating continuous pressing or multiple presses. The idea is to replace temporarily the direction keys of a game with a modifier, e.g. when pressing shift (or another modifier) to continually press A, S, D, or F depended on mouse motion.

I might test it/alter it anyway.

EDIT: Followup is answered here: https://autohotkey.com/boards/viewtopic.php?f=5&t=32462

Return to “Gaming”

Who is online

Users browsing this forum: bidomo, Google [Bot] and 9 guests