 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tom.luft
Joined: 11 Feb 2010 Posts: 8
|
Posted: Thu Feb 11, 2010 9:29 pm Post subject: How to capture Logitech N305 Numpad '=', '(' and ')' keys |
|
|
I recently bought the wireless Logitech N305 Numpad for using it with Ableton Live. I managed to assign all the keys to my prefered actions (like undo, redo, create a new track and so on) - except the ones mentioned in the subject.
I know that the Numpad sends ALT-Codes to create the characters. For example in the key log for the '=' character:
| Code: | 90 145 d 6.17 NUM-FESTSTELL
90 145 u 0.02 NUM-FESTSTELL
A4 038 d 0.03 ALT
66 04D d 0.00 6 (ZEHNERTASTATUR)
66 04D u 0.02 6 (ZEHNERTASTATUR)
61 04F d 0.00 1 (ZEHNERTASTATUR)
61 04F u 0.03 1 (ZEHNERTASTATUR)
A4 038 u 0.02 ALT
90 145 d 0.25 NUM-FESTSTELL
90 145 u 0.03 NUM-FESTSTELL |
what I interpret as follows:
| Code: | | NUMLOCK DOWN + ALT DOWN + Numpad6 + Numpad1 + ALT UP + NUMLOCK UP |
( and ) are similar, just with an other code (40 and 41).
So how can I capture this action?
Maybe it helps to know, that the numpad creates all its Numpad - Keys as follows:
| Code: | 90 145 d 9.88 NUM-FESTSTELL
90 145 u 0.02 NUM-FESTSTELL
65 04C # d 0.03 5 (ZEHNERTASTATUR)
65 04C u 0.03 5 (ZEHNERTASTATUR)
90 145 d 0.30 NUM-FESTSTELL
90 145 u 0.03 NUM-FESTSTELL |
Thanks for your help!
Last edited by tom.luft on Sat Feb 13, 2010 10:30 am; edited 3 times in total |
|
| Back to top |
|
 |
tom.luft
Joined: 11 Feb 2010 Posts: 8
|
Posted: Fri Feb 12, 2010 1:05 pm Post subject: |
|
|
| Any suggestions? |
|
| Back to top |
|
 |
tom.luft
Joined: 11 Feb 2010 Posts: 8
|
Posted: Fri Feb 12, 2010 10:36 pm Post subject: |
|
|
My current solution looks like | Code: | !Numpad6::
KeyWait, Numpad1, D
MsgBox =
Return
!Numpad4::
KeyWait, Numpad0, D
MsgBox (
Return |
The problem is, that you can't assign a hotkey two times, so I can't capture Alt-Numpad4-Numpad0 AND Alt-Numpad4-Numpad1. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
|
| Back to top |
|
 |
tom.luft
Joined: 11 Feb 2010 Posts: 8
|
Posted: Sat Feb 13, 2010 10:23 am Post subject: |
|
|
I tried it with GetKeyState in several variations, but it won't work.
This won't work:
| Code: | *Numpad4::
If(GetKeystate("Alt","P")) {
if(GetKeyState("Numpad0","P")) {
MsgBox 40
}
if(GetKeyState("Numpad1","P")) {
MsgBox 41
}
}
Return |
and this neither:
| Code: | *Numpad4:
If (GetKeyState("Alt","P") && GetKeyState("Numpad0","P")) {
MsgBox 40
}
If (GetKeyState("Alt","P") && GetKeyState("Numpad1","P")) {
MsgBox 41
}
Return |
I would like to catch the following:
| Code: | | Alt down | Numpad4 down | Numpad4 up | Numpad0 down | Numpad0 up | Alt up |
It seems to be so simple but it simply won't work! |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 627
|
Posted: Sat Feb 13, 2010 12:34 pm Post subject: |
|
|
This works...
| Code: | !Numpad4::
KeyWait, Numpad4 ;Alt & Numpad4 both down .. wait for Numpad4 to be released
While GetKeyState("Alt","P")
{
If GetKeyState("Numpad0","P")
{
KeyWait, Numpad0 ;Alt & Numpad0 both down .. wait for Numpad0 to be released
MsgBox Alt 4 0 pressed ;Do action here
Return
}
Sleep, 1
}
Return |
|
|
| Back to top |
|
 |
tom.luft
Joined: 11 Feb 2010 Posts: 8
|
Posted: Sat Feb 13, 2010 9:02 pm Post subject: |
|
|
Indeed!
Thank you very much! |
|
| Back to top |
|
 |
benjohnson2001 Guest
|
Posted: Fri Mar 05, 2010 5:14 am Post subject: |
|
|
I have the same problem, I followed the steps above but I get a smiley face before every keystroke I send for the "=" and ")" keys! I would really appreciate anyone that could help me.
| Code: | !Numpad6::
KeyWait, Numpad1, D
send k
Return
!Numpad4::
KeyWait, Numpad4 ;Alt & Numpad4 both down .. wait for Numpad4 to be released
While GetKeyState("Alt","P")
{
If GetKeyState("Numpad0","P")
{
KeyWait, Numpad0 ;Alt & Numpad0 both down .. wait for Numpad0 to be released
send d
Return
}
If GetKeyState("Numpad1","P")
{
KeyWait, Numpad1 ;Alt & Numpad0 both down .. wait for Numpad0 to be released
send z
Return
}
Sleep, 1
}
Return
|
|
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 627
|
Posted: Sat Mar 13, 2010 12:21 pm Post subject: |
|
|
| benjohnson2001 wrote: | | I have the same problem, I followed the steps above but I get a smiley face before every keystroke I send for the "=" and ")" keys! |
This should do the trick... ☺ | Code: | !Numpad6::
KeyWait, Numpad1, D
Send k
Return
!Numpad1::Return ;So doesn't send "☺" on the Alt-1 part of Alt-4-1
!Numpad4::
KeyWait, Numpad4 ;Alt & Numpad4 both down .. wait for Numpad4 to be released
While GetKeyState("Alt","P")
{
If GetKeyState("Numpad0","P")
{
KeyWait, Numpad0 ;Alt & Numpad0 both down .. wait for Numpad0 to be released
Send d
Return
}
If GetKeyState("Numpad1","P")
{
KeyWait, Numpad1 ;Alt & Numpad0 both down .. wait for Numpad0 to be released
Send z
Return
}
Sleep, 1
}
Return |
|
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 627
|
Posted: Sat Mar 13, 2010 1:24 pm Post subject: |
|
|
Harking back to here..
| tom.luft wrote: | My current solution looks like | Code: | !Numpad6::
KeyWait, Numpad1, D
MsgBox =
Return
!Numpad4::
KeyWait, Numpad0, D
MsgBox (
Return |
The problem is, that you can't assign a hotkey two times, so I can't capture Alt-Numpad4-Numpad0 AND Alt-Numpad4-Numpad1 |
This allows for 2 identical hotkey assigns, however i think that after the initial default of 15ms, the 2nd !Numpad4:: routine will interrupt the 1st, and will stay there until Numpad1 is "pressed", so the !Numpad4-Numpad0 combo will not be detected (?)
| Code: | SetTitleMatchMode, 3
!Numpad6::
KeyWait, Numpad1, D
Send k
Return
#IfWinExist, ahk_class BaseBar ;always exists (creates context-sensitive hotkey)
!Numpad4::
KeyWait, Numpad0, D
Send d
Return
#IfWinExist, ahk_class Shell_TrayWnd ;always exists (creates another separate context-sensitive hotkey)
!Numpad4::
KeyWait, Numpad1, D
Send z
Return
#IfWinExist
!Numpad1::Return ;So doesn't send "☺" on the Alt-1 part of Alt-4-1 |
|
|
| Back to top |
|
 |
Lishtenbird
Joined: 10 Dec 2010 Posts: 2
|
Posted: Fri Dec 10, 2010 10:33 pm Post subject: |
|
|
Sorry for necroposting, but...
| Quote: | | I recently bought the wireless Logitech N305 Numpad for using it with Ableton Live. I managed to assign all the keys to my prefered actions (like undo, redo, create a new track and so on) - except the ones mentioned in the subject. |
I am currently looking for a small external keypad to map custom keystrokeys with autohotkey to these keys. The problem is that (no surprise) an external numpad would send keycodes identical to the keycodes of the main keyboard's numpad. So the question is, does the Logitech N305 Numpad send other keycodes that one can easily map, or your main (notebook, probably?) keyboard does not have a numpad?
Thanks you in advance, your information would help me a lot. I might need turn to Logitech G13, but I am looking for a lighter solution. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Fri Dec 10, 2010 10:38 pm Post subject: |
|
|
you can tell which keyboard generated they keystroke in some cases. look at AHKHID
I think if you search around on that term, you can find examples of people detecting keys only from a certain keyboard. _________________
(Common Answers) |
|
| Back to top |
|
 |
Lishtenbird
Joined: 10 Dec 2010 Posts: 2
|
Posted: Sat Dec 11, 2010 7:04 pm Post subject: |
|
|
| Quote: | | you can tell which keyboard generated they keystroke in some cases. look at AHKHID |
Thanks, I've had no luck with AHKID before, but I'll take a look at HIDmacros. |
|
| Back to top |
|
 |
specter333
Joined: 15 Jan 2007 Posts: 527
|
Posted: Sat Dec 11, 2010 11:29 pm Post subject: |
|
|
| Lishtenbird wrote: | | Quote: | | you can tell which keyboard generated they keystroke in some cases. look at AHKHID |
Thanks, I've had no luck with AHKID before, but I'll take a look at HIDmacros. |
AHKHID should be able to do the trick for you. In the Building a script example the script bases whether or not it's getting keystrokes from the correct input device by determining if it has the right vendor ID, product ID and version number. Only then does it pass the keystrokes to the labels. I posted a gui to make it simple to get the correct codes from "Other HID" devices but haven't gotten to mice or keyboards yet but they shouldn't be that different. Looking the the pictures should give you and idea of how AHKHID differentiates between input devices.
http://www.autohotkey.com/forum/viewtopic.php?t=41397&start=230 |
|
| 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
|