0

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.

mythofechelon
  • 3,692
  • 11
  • 37
  • 48

3 Answers3

2

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
echristopherson
  • 6,974
  • 2
  • 21
  • 31
Elliot DeNolf
  • 2,920
  • 1
  • 15
  • 12
  • Ooo, that's very promising! However, I notice that the command executes on more key presses than the, requested, sequential `Enter`. Could that be implemented? – mythofechelon Oct 22 '12 at 19:23
  • I have edited my answer to include a way to do this. However, it does affect hotstrings globally, so I would suggest putting it in a script separate from other hotstrings. There may be another way by using KeyWait that would be worth exploring if this is not satisfactory. – Elliot DeNolf Oct 22 '12 at 19:24
  • Well, I just implemented your suggested method and then tested all of my scripts. They all seem to be working flawlessly. I tip my hat to you, good sir. Thank you, very much. If I have any issues I'll report back to you. Could you give me any examples of potential issues, though? – mythofechelon Oct 22 '12 at 19:29
  • #Hotstring does not affect hotstrings that have an * in their options. For others, I would think that if you wanted your hotstrings to fire when pressing any other keys such as tab, space, ;, etc. they may not work. – Elliot DeNolf Oct 22 '12 at 19:39
0

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".

Robert Ilbrink
  • 7,738
  • 2
  • 22
  • 32
0

This hotstring worked for me.

:*:`{`n:: 

That should catch it without need for settning the EndChars.