Насколько знаю, джойстик с помощью АНК не спрятать. Т.е. одновременно будут видны симулированные события мыши и настоящие события джойстика.
Что касается твоей просьбы, то сам я вряд ли смогу существенно помочь, т.к. джойстика у меня нет и не на чем тестить пробные варианты кода. Более того, у меня его никогда не было и я смутно представляю, какая там кнопка главная и какая неглавная. Но думаю, что если ОЧЕНЬ НАДО, то ты сам сможешь докопаться. Пробуй и смотри, что получается.
Далее следует скрипт из справки АНК, который будто бы превращает джойстик в мышь.
; Увеличьте это значение, чтобы курсор двигался быстрее.
JoyMultiplier = 0.30
; Уменьшите это значение, чтобы курсор начинал двигаться при меньшем отклонении
; осей джойстика. Однако, может понадобиться калибровка джойстика, чтобы добиться
; его хорошей центровки и избежать дрейфа курсора. С хорошо отцентрованным
; джойстиком может использоваться значение 1.
JoyThreshold = 3
; Измените значение на true, чтобы инвертировать ось Y и заставить мышь
; двигаться вертикально в направлении, обратном движению рукоятки (или как там
; эта штука называется - YMP).
InvertYAxis := false
; Измените эти значения, чтобы использовать для кнопок мыши другие кнопки
; джойстика, а не 1, 2 и 3. Возможные значения от 1 до 32.
ButtonLeft = 1
ButtonRight = 2
ButtonMiddle = 3
; Если ваш джойстик имеет POV control (понятия не имею, что за фигня - YMP),
; вы можете использовать его как колесо мыши. Значение ниже означает количество
; миллисекунд между поворотами колеса. Уменьшите, чтобы ускорить колесо.
WheelDelay = 250
; Если в системе больше одного джойстика, укажите здесь номер того, который
; нужно использовать.
JoystickNumber = 1
; КОНЕЦ РАЗДЕЛА НАСТРОЕК -- не изменяйте то, что ниже, если только вы не
; хотите изменить базовый функционал скрипта.
#SingleInstance
JoystickPrefix = %JoystickNumber%Joy
Hotkey, %JoystickPrefix%%ButtonLeft%, ButtonLeft
Hotkey, %JoystickPrefix%%ButtonRight%, ButtonRight
Hotkey, %JoystickPrefix%%ButtonMiddle%, ButtonMiddle
; Calculate the axis displacements that are needed to start moving the cursor:
JoyThresholdUpper := 50 + JoyThreshold
JoyThresholdLower := 50 - JoyThreshold
if InvertYAxis
YAxisMultiplier = -1
else
YAxisMultiplier = 1
SetTimer, WatchJoystick, 10 ; Monitor the movement of the joystick.
GetKeyState, JoyInfo, %JoystickNumber%JoyInfo
IfInString, JoyInfo, P ; Joystick has POV control, so use it as a mouse wheel.
SetTimer, MouseWheel, %WheelDelay%
return ; End of auto-execute section.
; The subroutines below do not use KeyWait because that would sometimes trap the
; WatchJoystick quasi-thread beneath the wait-for-button-up thread, which would
; effectively prevent mouse-dragging with the joystick.
ButtonLeft:
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
SetTimer, WaitForLeftButtonUp, 10
return
ButtonRight:
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, right,,, 1, 0, D ; Hold down the right mouse button.
SetTimer, WaitForRightButtonUp, 10
return
ButtonMiddle:
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, middle,,, 1, 0, D ; Hold down the right mouse button.
SetTimer, WaitForMiddleButtonUp, 10
return
WaitForLeftButtonUp:
if GetKeyState(JoystickPrefix . ButtonLeft)
return ; The button is still, down, so keep waiting.
; Otherwise, the button has been released.
SetTimer, WaitForLeftButtonUp, off
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
WaitForRightButtonUp:
if GetKeyState(JoystickPrefix . ButtonRight)
return ; The button is still, down, so keep waiting.
; Otherwise, the button has been released.
SetTimer, WaitForRightButtonUp, off
MouseClick, right,,, 1, 0, U ; Release the mouse button.
return
WaitForMiddleButtonUp:
if GetKeyState(JoystickPrefix . ButtonMiddle)
return ; The button is still, down, so keep waiting.
; Otherwise, the button has been released.
SetTimer, WaitForMiddleButtonUp, off
MouseClick, middle,,, 1, 0, U ; Release the mouse button.
return
WatchJoystick:
MouseNeedsToBeMoved := false ; Set default.
SetFormat, float, 03
GetKeyState, joyx, %JoystickNumber%JoyX
GetKeyState, joyy, %JoystickNumber%JoyY
if joyx > %JoyThresholdUpper%
{
MouseNeedsToBeMoved := true
DeltaX := joyx - JoyThresholdUpper
}
else if joyx < %JoyThresholdLower%
{
MouseNeedsToBeMoved := true
DeltaX := joyx - JoyThresholdLower
}
else
DeltaX = 0
if joyy > %JoyThresholdUpper%
{
MouseNeedsToBeMoved := true
DeltaY := joyy - JoyThresholdUpper
}
else if joyy < %JoyThresholdLower%
{
MouseNeedsToBeMoved := true
DeltaY := joyy - JoyThresholdLower
}
else
DeltaY = 0
if MouseNeedsToBeMoved
{
SetMouseDelay, -1 ; Makes movement smoother.
MouseMove, DeltaX * JoyMultiplier, DeltaY * JoyMultiplier * YAxisMultiplier, 0, R
}
return
MouseWheel:
GetKeyState, JoyPOV, %JoystickNumber%JoyPOV
if JoyPOV = -1 ; No angle.
return
if (JoyPOV > 31500 or JoyPOV < 4500) ; Forward
Send {WheelUp}
else if JoyPOV between 13500 and 22500 ; Back
Send {WheelDown}
return