Replace [ with { and ] with } using AutoHotkey

Using curly brackets for raw key interpretation is only for the Send commands. So, to map [ to { and ] to } you can use:

[::Send, {{}
]::Send, {}}

Note: Remapping a key with its Shift equivalent is troublesome, as most if not all keyboards send the same scancode each time, the only difference being the introduction of the Shift key (which has its own scancode).

For example, pressing [ on my keyboard sends the scancode 01A and yields a [. Pressing LShift+[ sends the scancodes 02A and 01A, yielding a {.


Update:

I have successfully overcome the scancode issue with some clever logic! Using the following format, you should be able to switch any key with its Shift pair. Key repetition should also work.

*$[::
    if (GetKeyState("Shift"))
        Send, {[}
    else
        Send, {{}  
    return

*$]::
    if (GetKeyState("Shift"))
        Send, {]}
    else
        Send, {}}
    return

Expanding on this idea, @Bob wrote a more robust version of the script:

*$[::
    if (GetKeyState("Shift"))
        SendInput, {[ Down}
    else
        SendInput, {{ Down}
    return

*$]::
    if (GetKeyState("Shift"))
        SendInput, {] Down}
    else
        SendInput, {} Down}
    return

*$[ Up::
    if (GetKeyState("Shift"))
        SendInput, {[ Up}
    else
        SendInput, {{ Up}
    return

*$] Up::
    if (GetKeyState("Shift"))
        SendInput, {] Up}
    else
        SendInput, {} Up}
    return

If I were presented the problem without seeing the answer above, I'd just add a few hotstrings per the example below.

:*?:[::
    SendInput, {Shift Down}`[{Shift up}
    return

:*?:]::
    SendInput, {Shift Down}`]{Shift Up}
    return

:*?:{::
    SendInput, `[
    return

:*?:}::
    SendInput, `]
    return