System Events seems inconsistent


tell application "System Events"
	keystroke "c" using {option down} --gives ç  as it should, but
	keystroke "2" using {option down, shift down} --gives 2 instead of €
end tell

Can you see any reason for that?

I have assigned a KM macro to Option / (slash)
another macro to Option . (period)
and a third macro to Option , (comma)

System Events will not work for the 2 first ones, but delivers for the third one. Why?

Script Editor 2.1.1
Mac mini Intel core 2 duo Tiger 10.4.11

Hi, Maurice.

keystroke “2” is too vague. There are (probably) two “2” keys on your keyboard. You want the one in the alpha-numeric section. On my UK keyboard, that key has the code number 19:

tell application "System Events"
	key code 19 using {option down, shift down} -- Just {option down} on UK keyboard.
end tell

Similarly with your other examples. The characters that fail are duplicated on the numeric keypad.

To find out the key codes on my computer, I use a free software utility called Full Key Codes.

Many thanks, Nigel. That was the reason my script failed. I tried to download Full Key Codes but I got the message: error : logs/downloads.log, whatever it means. I tried a few more times without success. Is there another way of getting hold of this handy little freeware?

PS: So, the script editor seems to give priority to the numerical pad (2 means num pad 2 unless specified otherwise) The good side of it is that, since the num pad does not consist of aliases, I can assign those keys to shortcuts.

I like this little free utility too. Maybe you will be able to download this one:

Model: G5 OSX 10.4.8
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

I’m getting that error at the moment too. :confused: But a quick Web search on “Full Key Codes” gives loads of libraries from which it can be downloaded.

All the Google listed addresses for “Full Key Codes” point to the same download site, which is the one that doesn’t work Never mind, I will use the software Matt-Boy suggested. Thank you

To make things more confused, I noticed a Javascript list of key codes which is different again!