How to make AHK to type braces (curly brackets) Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
ujm

How to make AHK to type braces (curly brackets)

06 Nov 2014, 22:16

A simple question, and probably answered several times already, but the answer seems hard to find. I want AHK to type a text that includes the braces { and }, which AHK normally uses to define blocks. How to do that? Thanks for your help!
Guest

Re: How to make AHK to type braces (curly brackets)

02 Jun 2016, 09:31

This solution works for curly braces in short cuts as well (thanks)

e.g.

:?:\scpr::${{}PWD/html/release/{}}

yielding

${PWD/html/release/}
Bluscream
Posts: 15
Joined: 10 Jan 2017, 23:12
GitHub: Bluscream

Re: How to make AHK to type braces (curly brackets)

10 Aug 2020, 13:38

Thanks for the tip, i made a little snippet to escape them:

Code: Select all

EscapeCurly(text) {
    ; str := StrReplace(str, "{", "{{}" ; Sends {
    ; str := StrReplace(str, "}", "{}}" ; Sends }
    ; return StrReplace(str, "{}", "{{}{}}" ; Sends {}
    Loop, Parse, text              ; retrieves each character from the variable, one at a time
    {
        if (A_LoopField == "{") {
            str .= "{{}"
        } else if (A_LoopField == "}") {
            str .= "{}}"
        } else {
            str .= A_LoopField
        }
    }
    return str
}

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], gioka, Google [Bot], Hackerxd, Melchisedek, mikeyww and 61 guests