vbs打开ie两种方法 在VBScript中启动IE浏览器的实现代码
程序员文章站
2023-12-13 14:12:28
第一种方法 internetexplorer.application
starturl = "www.jb51.net"
set ie = createobj...
第一种方法 internetexplorer.application
starturl = "www.jb51.net" set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate starturl
第二种方法 wscript.shell
dim wsh set wsh=wscript.createobject("wscript.shell") on error resume next wsh.run www.jb51.net
下面的代码就是自动打开百度并输入进行搜索的代码
dim wsh,ie set wsh = createobject("wscript.shell") set ie = wscript.createobject("internetexplorer.application") url=" http://www.baidu.com" code="" ie.visible = true ie.navigate url wscript.sleep 1000 wsh.appactivate "百度一下,你就知道 " ' 引号中填浏览器最上面的标题 wsh.run "cmd.exe /c echo " & code & "| clip.exe", vbhide wsh.sendkeys "^v" wsh.sendkeys "{enter}"
用vbs实现网站自动登录
dim wsh,ie set wsh = createobject("wscript.shell") set ie = wscript.createobject("internetexplorer.application") url=" http://www.baidu.com" ie.visible = true ie.navigate url wscript.sleep 1000*5 wsh.appactivate " " ' 引号中填浏览器最上面的标题 wscript.sleep 1000*1 wsh.sendkeys "帐号" '引号中填帐号 wscript.sleep 1000*1 wsh.sendkeys "{tab}" wscript.sleep 1000*1 wsh.sendkeys "密码" '引号中填密码 wscript.sleep 1000*1 wsh.sendkeys "{enter}"
好了,内容就介绍到这,希望大家以后多多支持。