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
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
flyway



Joined: 17 Nov 2009
Posts: 30

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

The MsgBox only appears when I push the switch up (closed position) when I need it to send the old "Down" keystroke.
And it sends "+^!7" (correctly).

It doesn't appear when I open the switch (pushing down) -> "Up" keystroke to be sent...

Confused

Any ideas?

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



Joined: 17 Nov 2009
Posts: 30

PostPosted: Sat Nov 21, 2009 11:04 am    Post subject: Reply with quote

Hey HKI,

Made same test but using 2JOY1, created a UP keystroke in the code and tested "2JOY1 UP::MsgBox" and also msgbox shows up when I press that push-button instead of showing up when I leave it... can it be the code not detecting when a button goes up ?
Just trying to figure out what's wrong here...

I thankyou very much your efforts about this project.

Cheers.
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Sat Nov 21, 2009 11:30 am    Post subject: Reply with quote

Have found how to monitor continuously the events ( Very Happy ) by double-clicking Autokey icon in tray...
And seems to me that both keystrokes are being sent simultaneously...
If it's the case, it's not the way I need it, sorry...

I need it to way for 2JOY26 to go UP, and then to send the "UP" keystroke. See?


Found something else... if I put KeyWait 2JOY26, U

Code:

SendUp:
KeyWait, 2JOY26, U
 StringReplace,hotkey,A_ThisHotkey,% " ",_
 SendInput % %hotkey%_sendup
Return


This is the result;

109: SendInput,%A_ThisHotkey%_send
110: Return
113: KeyWait,2JOY26,U (0.03)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return (0.11)
097: GetKeyState,POV,2JoyPOV
098: if POV not in 18000,0,9000
099: Return
114: StringReplace,hotkey,A_ThisHotkey," ",_
115: SendInput,%hotkey%_sendup

(this separation in time from 1st "SendInput" and the 2nd "StringReplace + SendInput" is the time I took from moving the switch from one position to other)


If I take out the KeyWait command, both "SendInput" commands appear next to each other, soon as I move switch to ON position.

109: SendInput,%A_ThisHotkey%_send
110: Return
114: StringReplace,hotkey,A_ThisHotkey," ",_
115: SendInput,%hotkey%_sendup

Anyway no Keystroke appears when switch is moved to OFF position in both cases. Sad
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Sun Nov 22, 2009 7:52 pm    Post subject: Reply with quote

Any ideas?
Am almost done with this project...
Just need a final "push" Very Happy

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



Joined: 17 Nov 2009
Posts: 30

PostPosted: Mon Nov 23, 2009 6:42 pm    Post subject: Reply with quote

New test...

Code:

SendUp:
KeyWait, 2JOY26, U
 ;StringReplace,hotkey,A_ThisHotkey,% " ",_
 SendInput +^!8 ;% %hotkey%_sendup
Return


Kept Keywait command and put this subrotine to send the keystroke needed.
Works like a charma now...
But ofcourse this code cannot be independent from that keystroke.

That's what's left to solve... Very Happy

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



Joined: 18 Jun 2008
Posts: 2143
Location: GERMANY

PostPosted: Tue Nov 24, 2009 5:56 am    Post subject: Reply with quote

I this works you can do:
Code:
KeyWait,%A_ThisHotkey%


Btw. there is no "U" option!

Can you confirm whether this script works for you:
Code:
2JOY26::MsgBox Down
2JOY26 UP::MsgBox UP

_________________
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: Tue Nov 24, 2009 8:04 am    Post subject: Reply with quote

Hey HKI,

Thanks to keep helping here.

This doesn't work.
With that code, both keystrokes (Down and Up) are sent immediately after each other, the Up keystroke doesn't wait for the "UP" event.
Code:

KeyWait,%A_ThisHotkey%

After some testing... it seems that in last subroutine for sending Up keytroke %A_ThisHotkey% contains something invalid for a KeyWait statement; "2JOY26 UP"...

Same with the other code...
Code:

2JOY26::MsgBox Down
2JOY26 UP::MsgBox UP


1st msgbox appears soon as I close the switch (down event), but
1st appears UP msgbox, and after pressing OK, it shows the Down msgbox, with no changing from the switch.
Maybe due to the position in code have put those lines...
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2143
Location: GERMANY

PostPosted: Tue Nov 24, 2009 11:17 am    Post subject: Reply with quote

What do you get here, how long is ToolTip shown?:
Code:
2JOY26::
ToolTip Down
KeyWait, A_ThisHotkey
ToolTip
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: Tue Nov 24, 2009 12:35 pm    Post subject: Reply with quote

Don't know exactly where to put those lines, but have tried them inside "sendup:" sub-routine, and some other places...
Also, at first compiler gives an error with that "KeyWait" line, so have changed it to
Code:

KeyWait, %A_ThisHotkey%


Anyway, no tooltip shown at all... Sad ... moving 2Joy26 switch.
Back to top
View user's profile Send private message
flyway



Joined: 17 Nov 2009
Posts: 30

PostPosted: Tue Nov 24, 2009 5:58 pm    Post subject: Reply with quote

Found the solution.

Code:

Loop 26 ;as many times as many hotkeys
 Hotkey,2JOY%A_Index%,Send
 Hotkey,2JOY26 UP,Sendup26
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_sendup26:=26_UP_%POV%
Return


Send:
 SendInput % %A_ThisHotkey%_send
Return

SendUp26:
KeyWait, 2Joy26
 SendInput % 2JOY26_sendup26
Return


Problem was that variable was badly formed.
Anyway, thanks alot HKI for your patience.

Now have another problem with some driving pedals converting them to rudder pedals... Very Happy
Gonna bring it to the top and try to get help.

Thanks alot mate.

Cheers.
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
Page 3 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