关于.VBS格式自动按键怎么选择执行窗口

来源:百度知道 编辑:UC知道 时间:2024/05/16 15:06:09
我想让电脑自己按键
Dim objws
Do
Set objws=WScript.CreateObject("wscript.shell")
WScript.Sleep 100
objws.SendKeys "d"
loop
怎么能在网络游戏中 执行
我试过 在永恒之塔 中不能按键 清高手给我指点一下

Dim objws
Do
Set objws=WScript.CreateObject("wscript.shell")
objws.AppActivate "窗口标题"
WScript.Sleep 100
objws.SendKeys "d"
loop
'这样试试行不行

au3脚本才能在指定窗口发送模拟键

If (@OSTYPE <> 'WIN32_NT') Then
MsgBox(0, '系统环境错误', '本程序只适用于 Windows NT/2000/XP/2003 系统!')
Exit
EndIf
If WinExists("永恒之塔") Then
SendKeepActive ("永恒之塔")
Send("!D")
EndIf

上面代码另存为.au3再用Aut2Exe转换为.exe