AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2 sets of keystrokes with 1 joystick
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 12:21 pm    Post subject: Reply with quote

Here we go Wink
Btw. why did you use 2JOY...
Code:
#Persistent

;ICP
1_18000_DOWN={Shift}{NumpadDiv}
2_18000_UP={Shift}{NumpadMult}
...
Loop 3 ;as many times as many hotkeys
{
 Hotkey,2JOY%A_Index% Down,SendDown
 Hotkey,2JOY%A_Index% Up,SendUp
SetTimer, WatchPOV, 100
return

WatchPOV:
GetKeyState, POV, 2JoyPOV  ; Get position of the POV control.
If POV not in 18000,0,9000
   Return

Loop 3 ;as many times as many hotkeys
   2JOY%A_Index%_senddown:=%A_Index%_%POV%_DOWN
   ,2JOY%A_Index%_sendup:=%A_Index%_%POV%_UP
Return

SendDown:
 SendInput % %A_ThisHotkey%_senddown
Return
SendUp:
 SendInput % %A_ThisHotkey%_sendup
Return

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 1:25 pm    Post subject: Reply with quote

Thanks my friend.

2Joy, because this is a 2nd joystick.
I have a cougar and a leo bodnar board and the code if for that board.

Abou that code, will it require all buttons to have "_DOWN" and "_UP" definitions ?
Because I only need DOWN and UP for the button 26, all other buttons can work just the way other code was...

Thanks again.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 1:40 pm    Post subject: Reply with quote

flyway wrote:
Thanks my friend.

2Joy, because this is a 2nd joystick.
I have a cougar and a leo bodnar board and the code if for that board.

Abou that code, will it require all buttons to have "_DOWN" and "_UP" definitions ?
Because I only need DOWN and UP for the button 26, all other buttons can work just the way other code was...

Thanks again.


It should be no problem to mix those, just use Hotkey,..., Send for the others and add a subroutine send.
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 2:20 pm    Post subject: Reply with quote

Did you mean this..?

Code:

#Persistent

;ICP
1_18000={Shift}{NumpadDiv}
2_18000={Shift}{NumpadMult}
3_18000={Shift}{Numpad7}
4_18000={Shift}{Numpad9}
5_18000={Shift}{Numpad0}
6_18000={Shift}{NumpadDot}
7_18000={Ctrl}{Numpad1}
8_18000={Ctrl}{Numpad2}
9_18000={Ctrl}{Numpad3}
10_18000={Ctrl}{NumpadDot}
11_18000={Ctrl}{NumpadAdd}
12_18000={Ctrl}{NumpadSub}
13_18000={Ctrl}{Numpad4}
14_18000={Ctrl}{Numpad5}
15_18000={Ctrl}{Numpad6}
16_18000={Ctrl}{NumpadEnter}
17_18000={Ctrl}{Numpad7}
18_18000={Ctrl}{Numpad8}
19_18000={Ctrl}{Delete}
20_18000={Ctrl}{Home}
21_18000={Ctrl}{Numpad9}
22_18000={Ctrl}{Numpad0}
23_18000={Ctrl}{PgDn}
24_18000={Ctrl}{Enter}
25_18000={Shift}{Ctrl}{Alt}W
26_18000_DOWN={Shift}{Ctrl}{Alt}7 ; Drift C/O On
26_18000_UP={Shift}{Ctrl}{Alt}8 ; Drift C/O Off

;MFDleft
1_0={Ctrl}{Alt}1
2_0={Ctrl}{Alt}2
3_0={Ctrl}{Alt}3

;MFDright
1_9000={Shift}1
2_9000={Shift}2
3_9000={Shift}3

Loop 26 ;as many times as many hotkeys
 Hotkey,2JOY%A_Index%,Send
SetTimer, WatchPOV, 100
return

Loop 26 ;as many times as many hotkeys
 Hotkey,2JOY%A_Index% Down,SendDown
 ,Hotkey,2JOY%A_Index% Up,SendUp
SetTimer, WatchPOV, 100
return

WatchPOV:
GetKeyState, POV, 2JoyPOV  ; Get position of the POV control.
If POV not in 18000,0,9000
   Return

Loop 26 ;as many times as many hotkeys
   2JOY%A_Index%_send:=%A_Index%_%POV%
Return

Loop 26 ;as many times as many hotkeys
   2JOY%A_Index%_senddown:=%A_Index%_%POV%_DOWN
   ,2JOY%A_Index%_sendup:=%A_Index%_%POV%_UP
Return

Send:
 SendInput % %A_ThisHotkey%_send
Return

SendDown:
 SendInput % %A_ThisHotkey%_senddown
Return
SendUp:
 SendInput % %A_ThisHotkey%_sendup
Return


This works for all buttons except for the 26.
Thou am not sure if the code was correctly appended.
BTW, is that coma correct?
Have added it just like you done few lines below, and braket "{" in same loop was giving error... so removed it.

Thanks.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 3:31 pm    Post subject: Reply with quote

Try this:
Code:
#Persistent

;ICP
1_18000=+{NumpadDiv}
2_18000=+{NumpadMult}
3_18000=+{Numpad7}
4_18000=+{Numpad9}
5_18000=+{Numpad0}
6_18000=+{NumpadDot}
7_18000=^{Numpad1}
8_18000=^{Numpad2}
9_18000=^{Numpad3}
10_18000=^{NumpadDot}
11_18000=^{NumpadAdd}
12_18000=^{NumpadSub}
13_18000=^{Numpad4}
14_18000=^{Numpad5}
15_18000=^{Numpad6}
16_18000=^{NumpadEnter}
17_18000=^{Numpad7}
18_18000=^{Numpad8}
19_18000=^{Delete}
20_18000=^{Home}
21_18000=^{Numpad9}
22_18000=^{Numpad0}
23_18000=^{PgDn}
24_18000=^{Enter}
25_18000=+^!W
26_18000_DOWN=+^!7 ; Drift C/O On
26_18000_UP=+^!8 ; Drift C/O Off

;MFDleft
1_0=^!1
2_0=^!2
3_0=^!3

;MFDright
1_9000=+1
2_9000=+2
3_9000=+3

Loop 25 ;as many times as many hotkeys
 Hotkey,2JOY%A_Index%,Send
Hotkey,2JOY26 Down,SendDown
Hotkey,2JOY26 Up,SendUP
SetTimer, WatchPOV, 100
return

WatchPOV:
GetKeyState, POV, 2JoyPOV  ; Get position of the POV control.
If POV not in 18000,0,9000
   Return

Loop 25 ;as many times as many hotkeys
   2JOY%A_Index%_send:=%A_Index%_%POV%
2JOY26_senddown:=2JOY26_%POV%_DOWN
2JOY26_sendup:=2JOY26_%POV%_UP
Return


Send:
 SendInput % %A_ThisHotkey%_send
Return

SendDown:
 SendInput % %A_ThisHotkey%_senddown
Return
SendUp:
 SendInput % %A_ThisHotkey%_sendup
Return

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 4:35 pm    Post subject: Reply with quote

Hey HKI,

It's giving me error at this line
"Hotkey,2JOY26 Down,SendDown" in the first loop 25.

We're almost there... Very Happy
Thanks alot.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 5:26 pm    Post subject: Reply with quote

Ah.. I think you do not need the down (only the UP) Smile
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 5:41 pm    Post subject: Reply with quote

Maybe you're right.
But how do I change the code... ? Embarassed

Because, don't believe being enough deleting "Send Down" lines... Very Happy

Thanks for your quickness, well for all.

Cheers.

PS: the error I mentioned above is as follows;
Error: "2JOY26 Down" is not a valid key name


Last edited by flyway on Fri Nov 20, 2009 5:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 5:45 pm    Post subject: Reply with quote

Code:
Hotkey,2JOY26 Down,SendDown
Hotkey,2JOY26,SendDown

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 5:52 pm    Post subject: Reply with quote

I deleted that word "Down" and then it gives me oanother error and in another line;

Line; SendInput % %A_ThisHotkey%_sendup
Error; The following variable name contains an illegal character "2JOY26 Up_sendup"
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 6:05 pm    Post subject: Reply with quote

Try this, I changed a few things:
Code:
#Persistent

;ICP
1_18000=+{NumpadDiv}
2_18000=+{NumpadMult}
3_18000=+{Numpad7}
4_18000=+{Numpad9}
5_18000=+{Numpad0}
6_18000=+{NumpadDot}
7_18000=^{Numpad1}
8_18000=^{Numpad2}
9_18000=^{Numpad3}
10_18000=^{NumpadDot}
11_18000=^{NumpadAdd}
12_18000=^{NumpadSub}
13_18000=^{Numpad4}
14_18000=^{Numpad5}
15_18000=^{Numpad6}
16_18000=^{NumpadEnter}
17_18000=^{Numpad7}
18_18000=^{Numpad8}
19_18000=^{Delete}
20_18000=^{Home}
21_18000=^{Numpad9}
22_18000=^{Numpad0}
23_18000=^{PgDn}
24_18000=^{Enter}
25_18000=+^!W
26_18000=+^!7 ; Drift C/O On
26_UP_18000=+^!8 ; Drift C/O Off

;MFDleft
1_0=^!1
2_0=^!2
3_0=^!3

;MFDright
1_9000=+1
2_9000=+2
3_9000=+3

Loop 26 ;as many times as many hotkeys
 Hotkey,2JOY%A_Index%,Send
Hotkey,2JOY26 Up,SendUP
SetTimer, WatchPOV, 100
return

WatchPOV:
GetKeyState, POV, 2JoyPOV  ; Get position of the POV control.
If POV not in 18000,0,9000
   Return

Loop 26 ;as many times as many hotkeys
   2JOY%A_Index%_send:=%A_Index%_%POV%
2JOY26_sendup:=2JOY26_UP_%POV%
Return


Send:
 SendInput % %A_ThisHotkey%_send
Return

SendUp:
 StringReplace,hotkey,A_ThisHotkey,% " ",_
 SendInput % %hotkey%_sendup
Return

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 6:12 pm    Post subject: Reply with quote

Thanks alot mate.

Now there's no errors, but the up keystroke doesn't work for the button 26.
All the rest is working as far as could test.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 6:26 pm    Post subject: Reply with quote

Does 2JOY26 UP work at all?
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Fri Nov 20, 2009 6:35 pm    Post subject: Reply with quote

HotKeyIt wrote:
Does 2JOY26 UP work at all?


Well, that's the only one being a switch instead of a push-button soldered to leo's board. It's at 26st button position.
So, in Games controler can see if activated when pushed to upper position and de-activated when in down position.

With this code it activates the keystroke for the upper position (standard 2Joy26 btn), but does nothing when I pull it down - Key "UP" in the code.

What else I should check?

Thanks.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2183
Location: GERMANY

PostPosted: Fri Nov 20, 2009 8:03 pm    Post subject: Reply with quote

You only need to check if this works:
Code:
2JOY26 UP::MsgBox

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group