 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Fri Nov 20, 2009 7:52 pm Post subject: |
|
|
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...
Any ideas?
Thanks bud. |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Sat Nov 21, 2009 11:04 am Post subject: |
|
|
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 |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Sat Nov 21, 2009 11:30 am Post subject: |
|
|
Have found how to monitor continuously the events ( ) 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.  |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Sun Nov 22, 2009 7:52 pm Post subject: |
|
|
Any ideas?
Am almost done with this project...
Just need a final "push"
Thanks. |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Mon Nov 23, 2009 6:42 pm Post subject: |
|
|
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...
Thanks in advance. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 2143 Location: GERMANY
|
Posted: Tue Nov 24, 2009 5:56 am Post subject: |
|
|
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) |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 24, 2009 8:04 am Post subject: |
|
|
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 |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 2143 Location: GERMANY
|
Posted: Tue Nov 24, 2009 11:17 am Post subject: |
|
|
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) |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 24, 2009 12:35 pm Post subject: |
|
|
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... ... moving 2Joy26 switch. |
|
| Back to top |
|
 |
flyway
Joined: 17 Nov 2009 Posts: 30
|
Posted: Tue Nov 24, 2009 5:58 pm Post subject: |
|
|
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...
Gonna bring it to the top and try to get help.
Thanks alot mate.
Cheers. |
|
| 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
|