Autohotkey在特定窗口中按下按键

问题描述:

我运行同一程序的多个窗口,并且我想让ahk按下所有窗口中的特定按钮,以检查“0”。我试过使用alt tab命令,它工作但只有一次,我无法正确地循环它。也许还有另一种更好的方法来让它在每个窗口中按下一个键?Autohotkey在特定窗口中按下按键

+0

看到文档:'winGet' - >列表CMD – Blauhirn

只要您使用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 

H个,