Question

As I've started using AutoHotKey daily, I thought it'd be a good idea to implement it in my coding.

I'd like it to create a structure like this:

{
    (Tab)
}

when { followed by an Enter are entered.

 

So far, I've got:

:*{Enter::
    SendInput, {{}
    SendInput, {Enter}
    SendInput, {Enter}
    SendInput, {}}
    SendInput, {Up}
    SendInput, {Tab}
return

but I keep getting errors and strange anomalies.

Was it helpful?

Solution

There are 2 things that must be included in order to get your code to work: 1. a backtick must be used for a curly bracket to be in hotstring 2. the option 'o' must be used to prevent a return from being sent after a curly bracket within your send command.

Try the following:

:o:`{::{{}`n`n{}}{up}{tab}

Hotstring options

Note: You may need to modify ending characters for this to fire only on Enter. This will affect hotstrings globally.

#Hotstring EndChars `n

OTHER TIPS

Try this.

Send, {{}{Enter}{tab}{Enter}{}}{up}{End}

This works for me, but your hotkey "*{Enter" was not accepted by my AutoHotKey_L, so I used an other temporary hotkey "^q".

This hotstring worked for me.

:*:`{`n:: 

That should catch it without need for settning the EndChars.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top