Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Xbox 360 controller as mouse + hotkeys


  • Please log in to reply
14 replies to this topic
apocalypse~r
  • Members
  • 41 posts
  • Last active: Sep 24 2009 02:14 PM
  • Joined: 21 Jun 2007
JoyMouse.ahk

It is a joystick to mouse script specifically configured to work with an xbox 360 controller with the windows standard drivers.

includes:
deadzone support
recentering of analog controls
changable sensitivity
useful, intuitive hotkeys (including customizable ones)
lots of features (including entire kbd & mouse)
integrated horizontal and vertical scrolling
mouse movement
keystroke sending
volume control

hotkeys and features:
A (joy1) left click (with drag support)
B (joy2) right click (w/ drag support)
X (joy3) middle click (no drag, but an easy fix)
Y (joy4) windows key (opens start menu)
LB (joy5) backspace
RB (joy6) enter
Back/Select (joy7) calibrate analog sticks
Start (joy8) pause movement (toggles control between controller and normal mouse)
LSB (joy9) adjust LS sensitivity (longer mouse blur = more sensitive)
RSB (joy10) adjust RS sensitivity (longer mouse blur = more sensitive)
Left Stick (joyX and joyY) mouse movement
Right Stick (joyR and joyU) scrolling (in 2 dimensions =])
Dpad - see THIS CHART. Also note that in the chart it is called POV not DPad, 0 = up, 9000 = right etc

Keyboard shortcuts:
control+left click - functions the same as Start (joy8), toggles control between controller and actual mouse
control+right click - opens the DPad linker, which assigns hotkeys to Dpad directions (7 assignable hotkeys) - this sets control to normal mouse. Due to wierd things happening if you try to move the script's window with the script (Deadlock until click from normal mouse), you should not unpause the controller until you have closed the window. Closing the window will save the hotkeys.[/url]

frost
  • Guests
  • Last active:
  • Joined: --
How Did you get the xbox 360 controller (wireless) to work on windows? What software / hardware did you use?

Also is it possible for me to tweak settings somewhere so i get an email when a reply is posted???? im a autohotkey nooby, but love it - it's a fantastic prigram

Regards , please email me: yoshiserry@gmail.com

help much appreciated.

apocalypse r
  • Guests
  • Last active:
  • Joined: --
I looked all over every store I could find and eventually I found one with a wired one is stock.
However, I think the charge n play kit can be used with a wireless controller. There are also numerous ways to convert an xbox controller into an xbox 360 controller.

As for software, the controller driver is nothing more than the crappy one that automatically installs when you plug in the controller (the default microsoft one)

Altoids
  • Guests
  • Last active:
  • Joined: --
You can't use a wireless controller with your PC unless you purchase a separate wireless receiver

The play and charge kit USB cable only transmits power and a short "Hey, sync me with you" signal, it doesn't transmit actual keystrokes

blondedude092
  • Members
  • 73 posts
  • Last active: May 14 2013 09:33 PM
  • Joined: 07 Jan 2009
Can you please take that script and just make it with all the actions to the buttons with // button A, Button B actions...
instead of the ones you made, I am having a hard time with understanding it all, but can you do that please.

Guest428
  • Guests
  • Last active:
  • Joined: --
It's working!! Except I am using dual monitors and it won't let me drag the mouse to my non primary while using the xbox 360 controller.

Guest428
  • Guests
  • Last active:
  • Joined: --
I used the calibration that came with it, and it messed up the sensitivity. Now I can't get it back to normal. Is there a way to reset to default on the sensitivity?

Klemash
  • Members
  • 1 posts
  • Last active: Jun 09 2011 06:27 AM
  • Joined: 09 Jun 2011

JoyMouse.ahk

It is a joystick to mouse script specifically configured to work with an xbox 360 key controller with the windows standard drivers.

includes:
deadzone support
recentering of analog controls
changable sensitivity
useful, intuitive hotkeys (including customizable ones)
lots of featuresPS3 Hack (including entire kbd & mouse)
integrated horizontal and vertical scrolling
mouse movement
keystroke sending
volume control

hotkeys and features:
A (joy1) left click (with drag support)
B (joy2) right click (w/ drag support)
X (joy3) middle click (no drag, but an easy fix)
Y (joy4) windows key (opens start menu)
LB (joy5) backspace
RB (joy6) enter
Back/Select (joy7) calibrate analog sticks
Start (joy8) pause movementwifirobin 3g (toggles control between controller and normal mouse)
LSB (joy9) adjust LS sensitivity (longer mouse blur = more sensitive)
RSB (joy10) adjust RS sensitivity (longer mouse blur = more sensitive)
Left Stick (joyX and joyY) mouse movement
Right Stick (joyR and joyU) scrolling (in 2 dimensions =])
Dpad - see THIS CHART. Also note that in the chart it is called POV not DPad, 0 = up, 9000 = right etc

Keyboard shortcuts:
control+left click - functions the same as Start (joy8), toggles control between controller and actual mouse
control+right click - opens the DPad linker, which assigns hotkeys to Dpad directions (7 assignable hotkeys) - this sets control to normal mouse. Due to wierd things happening if you try to move the script's window with the script (Deadlock until click from normal mouse), you should not unpause the controller until you have closed the window. Closing the window will save the hotkeys.[/url]

Except I am using dual monitors and it won't let me drag the mouse to my non primary while using the xbox 360 controller.

dater
  • Members
  • 30 posts
  • Last active: Mar 29 2013 05:43 AM
  • Joined: 20 Apr 2007
Hi,
Can you embed Chatpad too?

Frankie
  • Members
  • 2930 posts
  • Last active:
  • Joined: 02 Nov 2008
I noticed you don't support the RT and LT. It can be done with XInput.

The wireless adapters were discontinued sometime last year. I got one right before then :)

esplode
  • Guests
  • Last active:
  • Joined: --

I noticed you don't support the RT and LT. It can be done with XInput.

The wireless adapters were discontinued sometime last year. I got one right before then :)


You can still find the adapters online in bundles with a controller. I just bought one off of TigerDirect, but I also saw them on Amazon.com. Just look up Xbox 360 Wireless Controller for Windows or something like that.

Ixtab
  • Members
  • 2 posts
  • Last active: May 22 2013 11:33 AM
  • Joined: 20 May 2013

Hi, I know this thread is pretty old, but it sounds like just what I need.  The link does not work though, so I was wondering if anyone had this and could send it to me or something?



fathom
  • Members
  • 12 posts
  • Last active: Sep 05 2013 06:35 PM
  • Joined: 27 Aug 2012

Looks like I saved it a while back

#SingleInstance force


;;;;;;;;TODO;;;;;;;;;;;;
;;  - Add method for holding mouse button
;;  - Add trigger support
;;  - Context-sensitive hotkeys http://www.autohotkey.com/docs/commands/Hotkey.htm



; Increase the following value to make the mouse cursor move faster:
JoyMultiplier = 0.30

; Decrease the following value to require less joystick displacement-from-center
; to start moving the mouse.  However, you may need to calibrate your joystick
; -- ensuring it's properly centered -- to avoid cursor drift. A perfectly tight
; and centered joystick could use a value of 1:
JoyThreshold = 15

; Change the following to true to invert the Y-axis, which causes the mouse to
; move vertically in the direction opposite the stick:
InvertYAxis := false

; Change these values to use joystick button numbers other than 1, 2, and 3 for
; the left, right, and middle mouse buttons.  Available numbers are 1 through 32.
; Use the Joystick Test Script to find out your joystick's numbers more easily.
ButtonLeft = 1
ButtonRight = 2
ButtonMiddle = 3
ButtonY = 4
ButtonLB = 5
ButtonRB = 6
ButtonSelect = 7
ButtonStart = 8

; If your joystick has a POV control, you can use it as a mouse wheel.  The
; following value is the number of milliseconds between turns of the wheel.
; Decrease it to have the wheel turn faster:
WheelDelay = 25

; If your system has more than one joystick, increase this value to use a joystick
; other than the first:
JoystickNumber = 1

; END OF CONFIG SECTION -- Don't change anything below this point unless you want
; to alter the basic nature of the script.

JoystickPrefix = %JoystickNumber%Joy
Hotkey, %JoystickPrefix%%ButtonLeft%, ButtonLeft
Hotkey, %JoystickPrefix%%ButtonRight%, ButtonRight
Hotkey, %JoystickPrefix%%ButtonMiddle%, ButtonMiddle
Hotkey, %JoystickPrefix%%ButtonY%, ButtonY
Hotkey, %JoystickPrefix%%ButtonLB%, ButtonLB
Hotkey, %JoystickPrefix%%ButtonRB%, ButtonRB
Hotkey, %JoystickPrefix%%ButtonSelect%, ButtonSelect
Hotkey, %JoystickPrefix%%ButtonStart%, ButtonStart


; 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

ButtonY:
yDown := true
	Loop 
	{
		KeyWait, %JoystickPrefix%%ButtonLB%, D T0.02
		If not ErrorLevel
		{
			Send ^+{Tab}
			break
		}
		KeyWait, %JoystickPrefix%%ButtonRB%, D T0.02
		If not ErrorLevel
		{
			Send ^{Tab}
			break
		}
		KeyWait, %JoystickPrefix%%ButtonRB%, D T0.02
		If not ErrorLevel
		{
			Send ^{Tab}
			break
		}
		KeyWait, %JoystickPrefix%%ButtonSelect%, D T0.02
		If not ErrorLevel
		{
			SendInput !{Tab}
			break
		}

		Sleep 10
	}
yDown := false
return

ButtonRB_Chrome:
Send ^l
return

ButtonLB_Chrome:
Send ^k
return


ButtonLB:
if !yDown
{
	Send !{Left}
}
return
ButtonRB:
if !yDown
{
	Send !{Right}
}
return

ButtonStart:
Send {LWin}
Return

ButtonSelect:

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 < 0  ; No angle.
    return
else if (JoyPOV > 31500)  ; Forward
    Send {WheelUp}
else if JoyPOV between 0 and 4500   ; Forward
	Send {WheelUp}
else if JoyPOV between 4501 and 13500 ; Right
	Send {WheelRight}
else if JoyPOV between 13501 and 22500  ; Back
    Send {WheelDown}
else									; Left
	Send {WheelLeft}  
return



Fenris
  • Members
  • 1 posts
  • Last active: Oct 05 2013 03:04 AM
  • Joined: 05 Oct 2013

Hi, I´m working on a sript to use the controller to play videogames, how can I switch the cursor movement from the left thumbstick to the right thumbstick?



00scott
  • Members
  • 1 posts
  • Last active: Oct 13 2013 10:29 AM
  • Joined: 06 Oct 2013

Hey guys this is going to sound noob-ish but I am using windows 7 and I have the charge and play kit and the remote with Microsoft standard software but I can't get it to toggle from mouse to remote. Any Ideas???  :/