Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Thank you for correcting my question, random, and I apologize if my English was too bad ^^' –  lartkma Mar 25 '11 at 4:06
add comment

2 Answers 2

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.

share|improve this answer
    
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 '11 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 '11 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 '11 at 23:10
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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