Autohotkey发送快捷方式

时间:2015-02-13 20:10:58

标签: keyboard-shortcuts autohotkey shortcut

我想在Visual Studio中的快捷方式之后添加一些按键。 当按下快捷方式Ctrl + 0, Ctrl + G时,它应该在Visual Studio中执行,之后应该按下9个选项卡。

我想出了这个:

^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

检查快捷方式到目前为止,但发送^0^g它什么都不做

1 个答案:

答案 0 :(得分:1)

尝试此操作,请注意所做的更改以及指向文档的链接以获取更多详细信息。

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