Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to create a dead key?


  • Please log in to reply
5 replies to this topic
homoludens1000
  • Members
  • 7 posts
  • Last active: Nov 09 2011 09:23 PM
  • Joined: 09 Nov 2011
Hi everyone,

I'm creating a character replacement script for inputting romanized Sanskrit.

Most of the special characters I need will be produced by pressing the RIGHT ALT key plus another one (so for example: RALT + a = ā, RALT + r = ṛ, etc.)

For two letters, I'd like to design a key combination where I first press RALT + - (hyphen), and then (after releasing the keys) the letter r or l respectively. So it's something similar to a dead key found on some European keyboards.

Does anyone know how I could do this using the AutoHotkey commands?

(PS: I realize, of course, the an easier option would be to simply use an additional modifier key, so for example ALT + CTRL + r, etc. I'd prefer the solution above, though, to prevent myself from confusing my character shortcuts with the shortcuts used by other programs ... )

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
This example implements RAlt and - as a deadkey:
;! AutoHotkey_L
deadkeys := {a: "½", b: "¾", c: "¿"} ; ... etc
>!-::
 Input, key, L1, {delete}{esc}{home}{end} ; ... etc
 Send % deadkeys[key]
return
It requires AutoHotkey_L

homoludens1000
  • Members
  • 7 posts
  • Last active: Nov 09 2011 09:23 PM
  • Joined: 09 Nov 2011
nimda, thanks for the code!

Stupid question, but if I downloaded AutoHotkey from the regular site, I probably don't have AutoHotkey_L, correct?

Can I assume that everything that worked under AutoHotkey will work under AutoHotkey_L as well?

twiz
  • Members
  • 33 posts
  • Last active: Oct 08 2013 11:47 PM
  • Joined: 08 Nov 2011

Stupid question, but if I downloaded AutoHotkey from the regular site, I probably don't have AutoHotkey_L, correct?

It depends on which link you downloaded, there's AutoHotKey_L and AutoHotKey Basic. Both are offered on the download page.

You want the top download from here, it's the one that "allows you to choose Unicode or ANSI, and 64-bit or 32-bit."

homoludens1000
  • Members
  • 7 posts
  • Last active: Nov 09 2011 09:23 PM
  • Joined: 09 Nov 2011
twiz, thanks, stupid question indeed. i just noticed that autohotkey_l is now the main developing branch, which i of course downloaded. case of bad memory ...

i'm not entirely clear on the script yet. am i right that it defines RAlt + - as a dead key, and that pressing DEL, HOME etc. after if would create 1/2, 3/4, etc.?

if that's the case, it's not working for me.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Nope. Pressing RAlt and - and then pressing a,b,or c will give you the new key.
Pressing RAlt and - and then pressing end, delete, or home will "end" the input, and nothing will be sent.

the list in {brackets} can be edited or extended.