Autohotkey 自动热键按特定窗口中的键

Autohotkey 自动热键按特定窗口中的键,autohotkey,Autohotkey,我运行同一程序的多个窗口,我想让ahk在所有窗口中按一个特定的按钮,例如“0”。我尝试使用alt-tab命令,但只运行了1次,无法正确循环。也许还有更好的方法让它在每个窗口中按一个键?只要您使用Internet Explorer,并且每个IE窗口都是独立的(不是在同一窗口的不同选项卡中),下面应该向您展示如何在每个打开的IE窗口中循环。它还将显示资源管理器窗口,因此您的代码可以在继续发送密钥之前首先确定窗口的类型 #NoEnv ; Recommended for performance and

我运行同一程序的多个窗口,我想让ahk在所有窗口中按一个特定的按钮,例如“0”。我尝试使用alt-tab命令,但只运行了1次,无法正确循环。也许还有更好的方法让它在每个窗口中按一个键?

只要您使用Internet Explorer,并且每个IE窗口都是独立的(不是在同一窗口的不同选项卡中),下面应该向您展示如何在每个打开的IE窗口中循环。它还将显示资源管理器窗口,因此您的代码可以在继续发送密钥之前首先确定窗口的类型

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, 2 ; approximate match
for x in ComObjCreate("Shell.Application").Windows {
    {
         MsgBox,,Open Windows, % "`n" x.locationName "`n`n" x.locationURL "`n`n" x.FullName "`n"
         winactivate, % x.locationName
         sleep, 1000
         WinMaximize, % x.locationName
         sleep, 1000
         ; do something here
    }
}
return

Hth,

参见文档:
winGet
->list cmd