I'm trying to use Autohotkey to map ´+a to something different than the á that is expected in my Spanish keyboard.

This thread gives me the impression that it is not possible, but I'm just a Autohotkey newbie.


I want to do that, and several more similar combinations trying to survive the hell of reaching a Mac machine from a Windows one through VNC

Edit with additonnal info

This is the key history displayed by AutoHotkey

VK  SC    Up/Down Elapsed Key
DE  028   d       3.74    ´                 
DE  028   u       0.16    ´                 
41  01E   d       0.25    A                 
41  01E   u       0.11    A

Well, you can't map a dead key directly; they are so called because they don't send a keycode to the system, but just notify the keyboard's microcontroller to possibly do something unusual with the next character typed.

What you probably can do, though, is map á itself; you may need to do a little hunting around to find the keycode (the AHK documentation keycode list is here, and a script that shows keycodes of pressed keys can be found here -- I'm not sure how accurate that last one is, but you can probably make something of it. Also, if you open the main script window from its system tray icon, then click "View -> Key History", you'll see a list of keys the script has seen pressed, which may well give you the keycode.

Anyway, once you know how to refer to a particular accented character in your scripts, you can map it to a fare-thee-well, just as with anything else on your keyboard.

  • Thanks! I added the Key History: it would be great if you could give me a hint of what should I be trying with them... – xverges Apr 10 '13 at 14:48
  • Wow! That dead key's not dead at all. Since it's got a scan code of its own, you can map just the dead key via the SCxxx form described in autohotkey.com/docs/KeyList.htm#SpecialKeys -- to map the combination of both keys entails essentially treating the dead key as a custom modifier key, which I haven't done before but this advice looks good: autohotkey.com/board/topic/… – Aaron Miller Apr 10 '13 at 14:54
  • Thanks for the pointer. ~SC028 & a:: blablabla sort of works. Sort of. The usual way to type an accented char is press and release <kbd>´</kbd> and then press and release <kbd>a</kbd>. This only works if <kbd>´</kbd> is kept pressed, and I don't think I will be able to convince my fingers that this is the proper way to type accented chars – xverges Apr 11 '13 at 16:28
  • Fair enough. So I can be sure I understand what you're after -- you're looking to have the same key sequence (', then a) produce the same result (á) on the OS X machine you're accessing remotely, as it does on the Windows machine you're sitting in front of, right? If so, I think I can see a way to do that, but it'd be every bit as ugly as complex AutoHotKey scripts always are... – Aaron Miller Apr 11 '13 at 18:17
  • Thanks a lot for your time. No need to get into ugly scripts for me: I ended up finding a VNC server/viewer combo that dealt properly with international keyboards out of the box (RealVNC) – xverges Apr 12 '13 at 4:11

Try this:

SoundBeep, 500, 500

B.t.w. I use these accented characters, but without using the international keyboard setting, but by using ahk This way I have full control (and no dead keys) The only problem is that this key will no longer work when used alone, it will function inside a word.

  • Thanks. Did not work. :*:e:: makes a beep, while :*:á:: or :*:´a:: do not. – xverges Apr 11 '13 at 16:12
  • Wow, this is unexpected. Thank you for the feedback. I checked it now and am stunned my self. – Robert Ilbrink Apr 11 '13 at 18:51
  • I'd have expected it to work as well, but looking at the key history output in the post, AutoHotkey seems to be seeing the "dead" key separately from the 'a' key. Very strange. – Aaron Miller Apr 11 '13 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.