Reputation: 12854
I want to add some keypresses after a shortcut in Visual Studio.
When pressing the shortcut Ctrl + 0, Ctrl + G
it should be executed in Visual Studio and after that 9 Tabs should be pressed.
I came up with this:
^0::
IfWinActive Visual Studio
{
Input, OutputVar, T1 L1
if OutputVar == g
Send, ^0^g
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
}
return
The check for the shortcut works so far, but sending ^0^g
it does nothing
Upvotes: 0
Views: 281
Reputation: 383
Try this, note the changes made and the links to the documentation for further details.
SetTitleMatchMode, 2
#IfWinActive Visual Studio ; a lot easier to use for context sensitive hotkeys
$^0:: ; for more info on $ see http://ahkscript.org/docs/Hotkeys.htm#Symbols
; Store the character for Ctrl-G in the CtrlG var. (7th letter)
; See doc http://ahkscript.org/docs/commands/Input.htm
Transform, CtrlG, Chr, 7
Input, OutputVar, T1 M L1 ; forgot the M option here
If OutputVar = %CtrlG%
{ ; don't forget the {} block after an if condition http://ahkscript.org/docs/commands/Block.htm
Send, ^0^g
Send, {Tab 9}
}
Return
Upvotes: 1