 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
David5555 Guest
|
Posted: Wed Apr 11, 2007 3:21 am Post subject: Using AutoHotKey with Logitech flight-sim like joysticks |
|
|
Hi,
I am want to use AutoHot Key with my Logitech Extreme 3d joystick. (Link Here:http://www.logitech.com/index.cfm/products/details/US/EN,CRID=12,CONTENTID=6954
Is it possible to use Auto Hot Key with this joystick?? After searching around the forum for almost 30 minutes and not being able to find anything this works, I am completely stumped on how to get this to work.
All I want to do is to simply remap the joysticks actions to keyboard keys.
Hopefully someone out there knows how to get this done!
Thanks in Advance!!!
David |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 846 Location: London, UK
|
|
| Back to top |
|
 |
david5555 Guest
|
Posted: Wed Apr 11, 2007 4:05 am Post subject: |
|
|
That is pretty much what I am looking for however the codes there will not make everything on this joystick work. I can get the buttons and POV to work, but when you add both codes to the same script, only the buttons will work. I still do not know how you would be able to control the throttle, left and the right axises.
For controlling the throttle, I tried using the POV script and replacing each instance of POV for throttle, but unfortunitly that did not work. |
|
| Back to top |
|
 |
david5555 Guest
|
Posted: Wed Apr 11, 2007 4:15 am Post subject: |
|
|
Ok, the main x and y axis are working fine now.
The only thing that I can not get working is the throttle. Perhaps someone knows how to control this and can post the code for controlling it.
I still unable to put more than one control in a script. So in other words I can only control one thing at a time.
Here is an example of what I mean:
(in the following example I have button control and POV control. Only the button control will work. However, when each script is loaded by itself it loads fine...)
| Code: |
Joy1::Send {Left} ; Have button #1 send a left-arrow keystroke.
Joy2::Click ; Have button #2 send a click of left mouse button.
Joy3::Send a{Esc}{Space}{Enter} ; Have button #3 send the letter "a" followed by Escape, Space, and Enter.
Joy4::Send Sincerely,{Enter}John Smith ; Have button #4 send a two-line signature.
#Persistent ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return
WatchAxis:
GetKeyState, JoyX, JoyX ; Get position of X axis.
GetKeyState, JoyY, JoyY ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
if JoyX > 70
KeyToHoldDown = Right
else if JoyX < 30
KeyToHoldDown = Left
else if JoyY > 70
KeyToHoldDown = Down
else if JoyY < 30
KeyToHoldDown = Up
else
KeyToHoldDown =
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down (or no key is needed).
{
if KeyToHoldDown
Send, {%KeyToHoldDown% down} ; Auto-repeat the keystroke.
return
}
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDownPrev ; There is a previous key to release.
Send, {%KeyToHoldDownPrev% up} ; Release it.
if KeyToHoldDown ; There is a key to press down.
Send, {%KeyToHoldDown% down} ; Press it down.
return
#Persistent ; Keep this script running until the user explicitly exits it.
SetTimer, WatchPOV, 5
return
WatchPOV:
GetKeyState, POV, JoyPOV ; Get position of the POV control.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
; Some joysticks might have a smooth/continous POV rather than one in fixed increments.
; To support them all, use a range:
if POV < 0 ; No angle to report
KeyToHoldDown =
else if POV > 31500 ; 315 to 360 degrees: Forward
KeyToHoldDown = Up
else if POV between 0 and 4500 ; 0 to 45 degrees: Forward
KeyToHoldDown = Up
else if POV between 4501 and 13500 ; 45 to 135 degrees: Right
KeyToHoldDown = Right
else if POV between 13501 and 22500 ; 135 to 225 degrees: Down
KeyToHoldDown = Down
else ; 225 to 315 degrees: Left
KeyToHoldDown = Left
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down (or no key is needed).
return ; Do nothing.
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDownPrev ; There is a previous key to release.
Send, {%KeyToHoldDownPrev% up} ; Release it.
if KeyToHoldDown ; There is a key to press down.
Send, {%KeyToHoldDown% down} ; Press it down.
return
|
|
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Wed Apr 11, 2007 4:21 am Post subject: |
|
|
can you have multiple scripts running - one for each control?
it's a hack, but you could have one script start alot of other scripts (with #NoTrayIcon) _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
david5555 Guest
|
Posted: Wed Apr 11, 2007 5:06 am Post subject: |
|
|
| engunneer wrote: | can you have multiple scripts running - one for each control?
|
Multiple scripts are no problem as long as they all run different function of the joystick.
What do you mean by having "#NoTrayIcon". All that does is just hide the tray icon, correct?
Would you be able to have multiple instances using the command "#SingleInstance off" and have each instance run a different script??
Thanks |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Wed Apr 11, 2007 5:11 am Post subject: |
|
|
if you have one script for each control? (have you tested it?)
you don't need #Singleinstance
#notrayicon so that if you need 10 scripts for the functions, then you don't have 10 tray icons. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Apr 12, 2007 3:12 pm Post subject: |
|
|
the beginning of the script is named auto-execute section (details in help file)
auto-execute code stops when it reaches the first hotkey
so the timer commands are never executed. |
|
| Back to top |
|
 |
jamestr
Joined: 05 Apr 2004 Posts: 96 Location: Connecticut USA
|
Posted: Thu Apr 12, 2007 3:13 pm Post subject: |
|
|
the beginning of the script is named auto-execute section (details in help file)
auto-execute code stops when it reaches the first hotkey
so the timer commands are never executed.
so move timers to beginning of script:
#line 1
SetTimer, WatchPOV, 5
SetTimer, WatchAxis, 5
Joy1::Send {Left}
etc........
Question, do logitech drivers permit adjusting axis sensitivity?? if yes i might purchase. thanks. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|