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.

Here is the code I have :

[::
Send [
Input, Char, T2 L1
if Char = a
{
    Send â
    return
}
Send %Char%
return

When I type [ then a, it has a normal behaviour and produces â. But, when I type [ then p, the character [ is not printed. The problem is the second line (Send [) in which [ is the character being remapped.

I tried the following without success :

  • Send `[

  • Send {[}

I want to print [ even if it is being remapped.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use $ as a modifier before the hotkey, i.e. $[::.

As the AHK documentation states:

This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself. The exact behavior of the $ prefix varies depending on operating system:

On Windows NT4/2k/XP or later: The $ prefix forces the keyboard hook to be used to implement this hotkey, which as a side-effect prevents the Send command from triggering it. The $ prefix is equivalent to having specified #UseHook somewhere above the definition of this hotkey.

On Windows 95/98/Me: The hotkey is disabled during the execution of its thread and re-enabled afterward. As a side-effect, if #MaxThreadsPerHotkey is set higher than 1, it will behave as though set to 1 for such hotkeys.

share|improve this answer
    
@Gradient You can use the Hotkey command, as in Hotkey +] Off before the Send followed by Hotkey +] On after the Send. That should always work. –  Bob Sep 7 '12 at 3:50
    
I deleted my question. For future readers, I said that this answer solved the question I asked, but not if I need to do this : +]:: ; Send }. I found out that I simply needed to encase this curly bracket inside curly brackets, like this : {}}. –  Gradient Sep 7 '12 at 4:12

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.