CommandKeyDown whichKey - how do I easily reference keypad numbers on Mac

Alan Gayne alanira9 at mac.com
Mon Jan 16 18:17:06 EST 2012


Greetings listMates,

I've got a series of similar keyboard shortcuts that are called by a "commandKeyDown whichKey" combination, where "whichKey" is intended to be a number.

on commandKeyDown whichKey
	switch whichKey
		case "1"
			(do stuff)
		break
		case "2"
			(do other stuff)
		break
		
		(and so forth)
	end switch
end commandKeyDown

No issue at all when "whichKey" is one of the numbers at the top of the QUERTY keyboard, but when I try to use the commandKeyDown number combination using the numbers on the extended keyboard keypad it didn't work.

So I checked which key was being returned for each of these keys, and got "65436" for keypad number 1, "65433" for keypad number 2, etc.

Now I can certainly script responses for each of the strange (to me) whichKey parameters coming off the keypad, but it would be a bit of a kludge, and it seems to me that there must be an easy way to make these keys return the numbers printed on each key, and which are typed every time I press one of these keys.

I'm on a 2011 iMac with extended keyboard running Snow Leopard 10.6.8 but I'd also like these shortcuts to work properly on a Windows desktop keyboard.

Anybody know the trick to making this work easy?  

Thanks in advance for your help in this matter. 

Kind regards,
Alan Gayne




More information about the use-livecode mailing list