AutoHotKeys中的窗口标题

时间:2011-01-17 20:23:11

标签: autohotkey

在AutoHotKeys中,如何编写if / then语句:

::create::
IF(Window.Title == 'Microsoft SQL Server Management Studio') {
   SendInput CREATE TABLE dbo.xxx({Enter}
   SendInput xxxID Int Identity(101,1) CONSTRAINT xxxID Primary Key{Enter}
}

3 个答案:

答案 0 :(得分:4)

获取窗口标题的方法有很多,但我想说最好的选择是使用WinGetTitle命令:

WinGetTitle, Window_Title, A ;A is for the active window
If (Window_Title = "Microsoft SQL Server Management Studio") {
}

答案 1 :(得分:2)

我认为IfWinActive命令最能满足您的需求。下面是按Win + C

时触发的示例
#c::
  IfWinActive, Microsoft SQL Server Management Studio
    Send, CREATE TABLE dbo.xxx({Enter}xxxID Int Identity(101,1) CONSTRAINT xxxID Primary Key{Enter}
return

答案 2 :(得分:0)

#IfWinActive Microsoft SQL Server Management Studio 
::create:: 
SendInput CREATE TABLE dbo.xxx({Enter} 
SendInput xxxID Int Identity(101,1) CONSTRAINT xxxID Primary Key{Enter} 
return