当我按下 ctrl+ 时我想要这个。
试过这个
^.::
IfWinExist Google Chrome
WinActivate, Google Chrome
else
run "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
return
Run Code Online (Sandbox Code Playgroud)
但每一次,它都会为我打开一个新的窗口。
默认情况下,Autohotkey 仅匹配窗口标题的开头,因此不会找到您的窗口,因为它们的格式New Tab - Google Chrome
您需要使用的是SetTitleMatchMode可以指定匹配窗口标题的任何部分而不是开头的命令。默认情况下,此选项设置为“1”。
SetTitleMatchMode, MatchMode
One of the following digits or the word RegEx:
1: A window's title must start with the specified WinTitle to be a match.
2: A window's title can contain WinTitle anywhere inside it to be a match.
3: A window's title must exactly match WinTitle to be a match.
Run Code Online (Sandbox Code Playgroud)
所以你正在寻找的是SetTitleMatchMode 2制作你的脚本:
^.::
SetTitleMatchMode 2
IfWinExist Google Chrome
WinActivate, Google Chrome
else
run "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
return
Run Code Online (Sandbox Code Playgroud)
这适用于我的机器
| 归档时间: |
|
| 查看次数: |
3326 次 |
| 最近记录: |