在 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}
}
在 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}
}
获取窗口标题的方法有很多种,但我想说最好的选择是使用 WinGetTitle 命令:
WinGetTitle, Window_Title, A ;A is for the active window
If (Window_Title = "Microsoft SQL Server Management Studio") {
}
我认为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
#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