举个例子:
贴段代码:
on error resume nextdim wsh,yeset wsh = createobject("wscript.shell")wsh.run "notepad"for i=1 to 10wscript.sleep 700wsh.appactivate("无标题-记事本")wsh.sendkeys "^v"wsh.sendkeys iwsh.sendkeys "%s"next
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
如果上面的appactivate激活的窗口不是在当前光标位置,如何选定该窗口??
方法:加上一句
wsh.sendkeys “{ENTER}”
附上修改后的代码:
on error resume nextdim wsh,yeset wsh = createobject("wscript.shell")wsh.run "notepad"for i=1 to 10wscript.sleep 700wsh.appactivate("无标题-记事本")wsh.sendkeys "{ENTER}"wsh.sendkeys "^v"wsh.sendkeys iwsh.sendkeys "%s"next
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12