AutoHotkey Community

It is currently May 24th, 2012, 10:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: April 11th, 2007, 3:21 am 
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. :x

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 3:34 am 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
http://www.autohotkey.com/docs/misc/RemapJoystick.htm


Is that what you are after :D

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 4:05 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 4:15 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 4:21 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
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)

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 5:06 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 5:11 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2007, 3:12 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2007, 3:13 pm 
Offline

Joined: April 5th, 2004, 7:24 pm
Posts: 98
Location: Connecticut USA
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Cephei1 and 66 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group