2

Is there a way to create a hotkey that reacts to a specific character, regardless of its position in the keyboard?

I have experimented with AutoHotKey and I have just realized something. For example, I wrote a simple hotkey to capture the " character:

"::Send {key}

I run the script (using an English layout keyboard) and it works. But I want the hotkey to work in another layout, so I try to change the Windows keyboard layout to "Spanish" (as an example) and (because I don't have another keyboard) use the Windows Screen Keyboard to emulate the Spanish Keyboard.

In it, I press the " key (which is above the 2 in that layout) and surprise! The hotkey doesn't work and the Send command is not executed.

Is it possible to create a hotkey bound to a specific character, regardless of its keyboard position? Or am I doing something wrong?

1
  • Thank you for correcting my question, random, and I apologize if my English was too bad ^^'
    – lartkma
    Mar 25, 2011 at 4:06

2 Answers 2

2

You might take a look in the AHK Help file for "Scan codes" for "special" keys. I'm using one for the "accent / back-tick" which is on the same key as the tilde on my U.S. keyboard, and the Scan Code for it is SC029.

0

What you want is called a hotstring. They are activated by strings instead of keys:

:*:"::@

This would replace the string " with @ immediately. The * switch means that it won't wait for a trigger character (such as a {space} or {tab}) before executing the replacement.

3
  • Thanks, but I think it isn't the thing I had in mind. I was trying to disable the default behavior of the " key, which is a dead key. Hotkeys do the work, but is dependand of the layout. Hotstrings acts on strings and consequently it won't disable the dead keys. I'm investigating how to detect the layout. But thank you so much, anyway
    – lartkma
    Mar 26, 2011 at 22:30
  • @lartkma: I'm not sure what you mean by "a dead key" and "disable the dead keys". I understood the question to ask "How can I make something happen when I press the key that makes the " character" which is what the hotsting does. you can change the hotstring to do just about anything, the same as the hotkeys.
    – yhw42
    Mar 27, 2011 at 13:54
  • don't worry, I don't ask directly about dead keys because I have almost achieved to disable it, and this was my last detail in order to obtain a global solution (in any machine)
    – lartkma
    Mar 27, 2011 at 23:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .