ShadowWesley77
ShadowWesley77

Reputation: 385

AHK in Visual studio 2013

I'm using a shortcut to remind me to use two equal signs to check for equality. heres my AHK code:

::if::
      Send, if 
      MsgBox Use two equal signs to check for equality!
Return

When I type 'if' it will bring up the box and keep the if the first time, after that it eats up the 'if' and doesn't print it. The code works fine for any other application but I can't get it to work in Visual Studio 2013. Also, it seems to work as expected when I try it in a comment. Any help would be appreciated!

Upvotes: 1

Views: 97

Answers (2)

phil294
phil294

Reputation: 10822

Attaching the option B0 to a hotstring prevents it from removing the previously typed phrase, so you don't have to re-send if again:

:B0:if::
      MsgBox Use two equal signs to check for equality!
Return

Upvotes: 3

fischgeek
fischgeek

Reputation: 688

I know you already have your answer, but I personally would hate a MsgBox every time I typed "if". You may want to look into using context sensitive hotkeys. Furthermore, instead of a MsgBox, you could use a less invasive ToolTip. This way, you could keep typing but still get notified.

CoordMode, Caret, Window
:B0:if::
    ToolTip, Use two equal signs to check for equality!, % A_CaretX, % A_CaretY+20
    Sleep, 3000
    ToolTip
return

Upvotes: 3

Related Questions