 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 17, 2009 12:18 pm Post subject: 2 sets of keystrokes with 1 joystick |
|
|
Hi all,
Have been searching for hours to try solving this problem. No "joy"
Am way no expert with this language, but here goes what I need.
I know how to program (using Send) keystrokes to a Joystick button.
But I need to have the re-mappings changed when I press a specific Joy button, for the same joystick.
Ex:
;Profile 1
Joy1:: Send {LShift}{NumpadDiv}
.
.
.
Joy32 -> "Load profile 2"
;profile2
Joy1:: Send {Shift}{Alt}1
.
.
.
Joy32 -> Load Profile 1
Hope made my self clear.
Thanks in advance. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Tue Nov 17, 2009 1:49 pm Post subject: |
|
|
Try this: | Code: | current=1
Hotkey,Joy1,1Joy1
1Joy1:
Send {LShift}{NumpadDiv}
Return
2Joy1:
Send {Shift}{Alt}1
Return
Joy32::
current++
If !IsLabel(%current%Joy1)
current=1
Hotkey,Joy1,%current%Joy1
Return |
or even simpler.
| Code: | Joy1::Send % (profile = 1 ? "{LShift}{NumpadDiv}" : "{Shift}{Alt}1")
Joy32::profile:=profile=2 ? 1 : 2 |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 17, 2009 2:48 pm Post subject: |
|
|
| HotKeyIt wrote: | Try this: | Code: | current=1
Hotkey,Joy1,1Joy1
1Joy1:
Send {LShift}{NumpadDiv}
Return
2Joy1:
Send {Shift}{Alt}1
Return
Joy32::
current++
If !IsLabel(%current%Joy1)
current=1
Hotkey,Joy1,%current%Joy1
Return |
or even simpler.
| Code: | Joy1::Send % (profile = 1 ? "{LShift}{NumpadDiv}" : "{Shift}{Alt}1")
Joy32::profile:=profile=2 ? 1 : 2 |
|
Hey mate, thanks.
But... 1Joy and 2Joy refer to multiple joysticks, I believe...
Correct me if am wrong, maybe am not understanding your 1st code, but that's not the problem.
Have only one joystick and want it to send some keys if "profile" is 1 and other keys (same joy) if "profile" is 2...
"Profile" is only a flag here, which is defined by the 32 or 31 button.
Thou, your 2nd code may solve this... will test it
Cheers.
Last edited by flyway on Tue Nov 17, 2009 3:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 17, 2009 3:19 pm Post subject: |
|
|
Well,
Your 2nd code works ok, till I try this...
| Code: |
Joy1::Send % (profile = 1 ? "{LShift down}{NumpadDiv down}" : "{Shift down}{Alt down}{1 down}")
KeyWait Joy1
Send % (profile = 1 ? "{LShift up}{NumpadDiv up}" : "{Shift up}{Alt up}{1 up}")
Joy31::profile:=profile=2 ? 1 : 2
|
Here, can only see the "down" assignements.  |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 17, 2009 7:02 pm Post subject: |
|
|
Could use some help here..
Anyone?
Cheers. |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 17, 2009 8:31 pm Post subject: |
|
|
This is what am trying to develop...
| Code: |
#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.
If POV=18000
profile=1
If POV=0
profile=2
If POV=9000
profile=3
Return
Joy1::Send % (profile = 1 ? "{LShift}{NumpadDiv}" : "{Ctrl}{Alt}1" : "{Shift}{Alt}1")
|
POV buttons to define what keys to send by each joystick button...
But like this, not working.
Can anyone help with this ?
Thanks. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Wed Nov 18, 2009 2:39 pm Post subject: |
|
|
| HotKeyIt wrote: | Have you checked if profile var is being set at all?
Does Send not work at all? |
Nop, didn't made any of those tests.
Thought this last code of mine was wrong anyware... is it wright? |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Wed Nov 18, 2009 5:20 pm Post subject: |
|
|
| flyway wrote: | | HotKeyIt wrote: | Have you checked if profile var is being set at all?
Does Send not work at all? |
Nop, didn't made any of those tests.
Thought this last code of mine was wrong anyware... is it wright? |
Try this: | Code: | _1800={LShift}{NumpadDiv}
_0={Ctrl}{Alt}1
_9000={Shift}{Alt}1
SetTimer, WatchPOV, 100
return
WatchPOV:
GetKeyState, POV, JoyPOV ; Get position of the POV control.
send:=_%POV%
Return
Joy1::SendInput % send |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Thu Nov 19, 2009 5:39 pm Post subject: |
|
|
Hey HotKeyIt,
Thanks alot for your efforts my friend.
Can understand your code, but there's a problem with it and it's because of mine, for lacking explanations...
I'll need that code to do exactly the same for all 32 buttons, see?
Same way... POV will tell what keys each button to send.
Believe that code will only work for button 1...
My bad, using JOY1 as an example, thought I could manage the rest of the code, but with your last code, cannot figure out how to do it...
Cheers. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Thu Nov 19, 2009 6:17 pm Post subject: |
|
|
| Code: | #Persistent
Loop 32
Hotkey,JOY%A_Index%,Send
_1800={LShift}{NumpadDiv}
_0={Ctrl}{Alt}1
_9000={Shift}{Alt}1
SetTimer, WatchPOV, 100
return
WatchPOV:
GetKeyState, POV, JoyPOV ; Get position of the POV control.
send:=_%POV%
Return
Send:
SendInput % send
Return |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Thu Nov 19, 2009 7:10 pm Post subject: |
|
|
Hey HKI,
Again, didn't express myself correctly.
Sorry for that, I sayd "...same for all 32 buttons", but this is not correct.
What's the same for all 32 buttons is the way POV defines keystrokes for each button.
But each Joystick button has it's 3 assignments and are not the same for all, see?
Example:
Profile=1
Joy1 send "Ctrl 1"
Joy2 send "Ctrl 2"
.
.
Profile=2
Joy1 send "Alt 1"
Joy2 send "Alt 2"
.
.
Profile=3
Joy1 send "Shift 1"
Joy2 send "Shitf 2"
.
.
Hope this explains it better.
Sorry again.
Thanks alot mate. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Thu Nov 19, 2009 8:58 pm Post subject: |
|
|
Try this: | Code: | #Persistent
1_1800=^1 ;JOY1 profile 1
2_1800=!1 ;JOY2 profile 1 ...
3_1800={LShift}{NumpadDiv}
1_0={Ctrl}{Alt}1 ;JOY1 profile 2 ...
2_0={Ctrl}{Alt}1
3_0={Ctrl}{Alt}1
1_9000={Shift}{Alt}1
2_9000={Shift}{Alt}1
3_9000={Shift}{Alt}1
Loop 3 ;as many times as many hotkeys
Hotkey,JOY%A_Index%,Send
SetTimer, WatchPOV, 100
return
WatchPOV:
GetKeyState, POV, JoyPOV ; Get position of the POV control.
If POV not in 1800,0,9000
Return
Loop 3 ;as many times as many hotkeys
JOY%A_Index%_send:=%A_Index%_%POV%
Return
Send:
SendInput % %A_ThisHotkey%_send
Return |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Thu Nov 19, 2009 9:23 pm Post subject: |
|
|
WOW, thanks alot.
That will require some study from me.
Will try it and keep you posted about it.
Thanks again.
Cheers. |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Fri Nov 20, 2009 10:57 am Post subject: |
|
|
Hey HotKeyIt,
Good news here. Thanks alot.
Now another problem am facing...
Here's my code (so far... POV=18000 is almost ready, other POV values still to be worked out...)
| 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={Shift}{Ctrl}{Alt}7 ; Drift C/O On
;??_18000={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 3 ;as many times as many hotkeys
Hotkey,2JOY%A_Index%,Send
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%_send:=%A_Index%_%POV%
Return
Send:
SendInput % %A_ThisHotkey%_send
Return
|
I need to assign {Shift}{Ctrl}{Alt}7 to button 26 (POV=26_18000) but when this joystivk button goes down.
And to assign {Shift}{Ctrl}{Alt}8 when it goes up.
See?
This should be same for any POV value.
Is this possible within this code... ?
Maybe best approach to work it out outside POV conditioning... asking...
Sorry to bother you so much.
Thanks mate. |
|
| 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
|