求大神帮忙写个VBS代码
求大神帮忙写个VBS代码,我想自动运行D:/a.exe程序,然后在这个程序界面上自动按‘F5’。
Dim WshShell, oNotepad Set WshShell = CreateObject("WScript.Shell") '创建WScript.Shell对象 Set oNotepad = WshShell.Exec("notepad") '运行记事本 WshShell.AppActivate oNotepad.ProcessID '激活记事本 WScript.Sleep 300 WshShell.SendKeys "CCCC" WScript.Sleep 300 WshShell.SendKeys "CCCC" WScript.Sleep 300 WshShell.SendKeys "CCCC" WScript.Sleep 300 WshShell.SendKeys "^a" 'CTRL+A组合键——全选 WScript.Sleep 200 WshShell.SendKeys "^c" 'CTRL+C组合键——复制 WScript.Sleep 200 WshShell.SendKeys "%{F4}" '关闭当前的记事本窗体 WScript.Sleep 300 WshShell.SendKeys "!n" '关闭当前的记事本窗体,不保存 WScript.Sleep 200 Set oNotepad = Nothing '释放内存 Set WshShell = Nothing
Dim WshShell, oNotepad Set WshShell = CreateObject("WScript.Shell") '创建WScript.Shell对象 Set oNotepad = WshShell.Exec("notepad") '这里修改为你的程序名称 WshShell.AppActivate oNotepad.ProcessID '激活你的程序 wscript.sleep 200 WshShell.SendKeys "{F5}" '模拟F5按键