使用剪贴板进行搜索查询时在浏览器中失去焦点 [autohotkey]

Lost focus in browser when using clipboard for search query [autohotkey]

我正在使用一个简单的脚本 运行 使用热键进行 google/wikipedia/etc 搜索,不幸的是,在搜索结果出现在新选项卡中后,我必须单击,因为该选项卡未在焦点上,尽管浏览器 windows 处于焦点状态。我试图添加一个 WinActivate,但它不起作用。在新的 OS 安装之前,该脚本曾按预期工作。为什么此脚本使浏览器失去焦点?

这是脚本

^+g:: 
{
Send, ^c
sleep 200
Run, https://www.google.com/search?hl=en&q=%Clipboard% 
sleep 50
WinActivate, ahk_exe waterfox.exe
}
Return

我不知道为什么,但看起来增加 运行 和 WinActivate 之间的延迟似乎可以解决这个问题。

^+g:: 
{
Send, ^c
sleep 200
Run, https://www.google.com/search?hl=en&q=%Clipboard% 
sleep 500 ;Up from 50, you might be able to fine-tune this number based on your computer's speed
WinActivate, ahk_exe waterfox.exe
}