AutoHotkey Community

It is currently May 27th, 2012, 2:46 am

All times are UTC [ DST ]




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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 12:04 pm 
Offline

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 12:30 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
Have found how to monitor continuously the events ( :D ) 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. :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 8:52 pm 
Offline

Joined: November 17th, 2009, 1:12 pm
Posts: 37
Any ideas?
Am almost done with this project...
Just need a final "push" :D

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 7:42 pm 
Offline

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

Thanks in advance.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 6:56 am 
Offline

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

_________________
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 24th, 2009, 9:04 am 
Offline

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


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

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
What do you get here, how long is ToolTip shown?:
Code:
2JOY26::
ToolTip Down
KeyWait, A_ThisHotkey
ToolTip
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 24th, 2009, 1:35 pm 
Offline

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


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

Joined: November 17th, 2009, 1:12 pm
Posts: 37
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... :D
Gonna bring it to the top and try to get help.

Thanks alot mate.

Cheers.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn, XstatyK and 20 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