AutoHotkey Community

It is currently May 27th, 2012, 5:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: February 11th, 2010, 10:29 pm 
Offline

Joined: February 11th, 2010, 10:09 pm
Posts: 8
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 February 13th, 2010, 11:30 am, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 2:05 pm 
Offline

Joined: February 11th, 2010, 10:09 pm
Posts: 8
Any suggestions?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 11:36 pm 
Offline

Joined: February 11th, 2010, 10:09 pm
Posts: 8
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 11:54 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Try:
Code:
*Numpad1::
If (GetKeyState("Alt","P") && GetKeyState("Numpad6","P"))
   MsgBox =
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: February 13th, 2010, 11:23 am 
Offline

Joined: February 11th, 2010, 10:09 pm
Posts: 8
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2010, 1:34 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2010, 10:02 pm 
Offline

Joined: February 11th, 2010, 10:09 pm
Posts: 8
Indeed!

Thank you very much!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2010, 6:14 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 1:21 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 2:24 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2010, 11:33 pm 
Offline

Joined: December 10th, 2010, 11:24 pm
Posts: 2
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2010, 11:38 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2010, 8:04 pm 
Offline

Joined: December 10th, 2010, 11:24 pm
Posts: 2
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2010, 12:29 am 
Offline

Joined: January 15th, 2007, 2:37 pm
Posts: 573
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/viewtop ... &start=230


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 69 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