欢迎来到天天文库
浏览记录
ID:15348289
大小:141.00 KB
页数:38页
时间:2018-08-02
《windows脚本编程核心技术精解-随书示例脚本-第五章》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、'5-1.VBS2'5-2.VBS4'5-3.VBS6'5-4.VBS8'5-5.VBS11'5-6.VBS13'5-7.VBS15'5-8.VBS18'5-9.VBS21'5-10.VBS24'5-11.VBS27'5-12.VBS30'5-13.VBS37'5-1.VBS'---thefollowinglineshavebeenaddedtoensureallrequiredCOMobjectsareavailableonyoursystem.'scriptusesthefollowingcomponents:'intern
2、etexplorer.applicationCheckCOM'---endofCOM-objectcheckingcode---setie=CreateObject("InternetExplorer.Application")MsgBox"ObjectType:"&TypeName(ie)ie.visible=trueMsgBox"InternetExplorerisvisiblenow!"ie.visible=falseMsgBox"Nowit'shidden!"ie.Quit'---thefollowingcodehadb
3、eenautomaticallyaddedtoensureallrequiredCOMobjectsareinstalled.functionCOMExists(name)'checkswhetheraspecificCOMobjectisinstalledon'yourlocalmachinesetcwsh=CreateObject("WScript.Shell")onerrorresumenextdummy=cwsh.RegRead("HKCR"&name&"")iferr.number<>0thenCOMExists=
4、falseelseCOMExists=trueendifendfunctionsubCheckCOMifnotCOMExists("internetexplorer.application")thenmsg="COM-Object""internetexplorer.application""isrequired.Thisobjectiscurrentlynotinstalledonyoursystem."&vbCrmsg=msg&"InstalltheInternetExplorerVersion4.0orabove."&vb
5、CrMsgBoxmsg,vbExclamationendifendsub'---endofCOMobjectcheckingcode'(C)2000byDr.T.Weltner-allrightsreserved.'5-2.VBS'---thefollowinglineshavebeenaddedtoensureallrequiredCOMobjectsareavailableonyoursystem.'scriptusesthefollowingcomponents:'internetexplorer.applicationC
6、heckCOM'---endofCOM-objectcheckingcode---setie=CreateObject("InternetExplorer.Application")scriptname=WScript.ScriptFullNamepath=left(scriptname,InstrRev(scriptname,""))filename=path&"showme.htm"MsgBox"Nowloading"&filenameie.navigatefilenameie.visible=trueMsgBox"Int
7、ernetExplorerisvisiblenow!",vbSystemModalMsgBox"Typeofdocument:"&TypeName(ie.document)ie.Quit'---thefollowingcodehadbeenautomaticallyaddedtoensureallrequiredCOMobjectsareinstalled.functionCOMExists(name)'checkswhetheraspecificCOMobjectisinstalledon'yourlocalmachinese
8、tcwsh=CreateObject("WScript.Shell")onerrorresumenextdummy=cwsh.RegRead("HKCR"&name&"")iferr.number<>0thenCOMExists=falseelseCOMEx
此文档下载收益归作者所有