Code: Select all
I'm writing a script to macro Chat Messages for a Xbox360 controller. A typical example would be to have a certain key respond the default way when pressed and released, but to run a macro when held. The following script works on all the regular buttons, and I'm pretty happy with the result:
Code: Select all
#InstallKeybdHook
#UseHook
;sends "Hello world" when Joypad Button1 is pressed and held for one second.
$Joy1::
KeyWait, Joy1, T1
If ErrorLevel = 1
{
send {enter}
send Hello world
send {enter}
}
Return
But now I want to add some more macros to the D-Pad which is slightly more tricky. (in my understanding, the d-pad outputs angles, rather than bindable keys. I found the following code online that should work, however, im finding difficulties to rebind the keys, never mind even applying the hold-button script. Ive done some testing to see all my POV values:
0 up
4500 up right
9000 right
13500 down right
18000 down
22500 left down
27000 left
31500 left up
Here is the script I found:
GetKeyState, POV, JoyPOV ; Get position of the POV control.
Code: Select all
if POV = -1 ; No angle to report
KeyToHoldDown =
else if POV = 0
KeyToHoldDown = XXXX
else if POV = 4500
KeyToHoldDown = YYYY
else if POV = 9000
KeyToHoldDown = ZZZZ
else
KeyToHoldDown = CCCC
return
Thanks in advance
3os