AutoHotkey Community

It is currently May 27th, 2012, 1:27 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: November 20th, 2009, 12:21 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Here we go ;)
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

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 1:25 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 1:40 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 2:20 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 3:31 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 4:35 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
Hey HKI,

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

We're almost there... :D
Thanks alot.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 5:26 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Ah.. I think you do not need the down (only the UP) :)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 5:41 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
Maybe you're right.
But how do I change the code... ? :oops:

Because, don't believe being enough deleting "Send Down" lines... :D

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 November 20th, 2009, 5:46 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 5:45 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Code:
Hotkey,2JOY26 Down,SendDown
Hotkey,2JOY26,SendDown

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 5:52 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
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"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 6:05 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 6:12 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 6:26 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Does 2JOY26 UP work at all?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 6:35 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 8:03 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
You only need to check if this works:
Code:
2JOY26 UP::MsgBox

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], iDrug, Ohnitiel, Yahoo [Bot] and 26 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