VBS一键配置VOIP脚本代码

VBS一键配置VOIP脚本代码,其中包括VBS操作JS网页中的按钮事件--直接执行确认按钮中的脚本代码,需要的朋友可以参考下

代码比较长,对vbs感兴趣的朋友可以参考一下

 Dim ws,fso,IE Set IE = WScript.createobject("InternetExplorer.Application") Set ws = WScript.CreateObject ("WSCript.shell") Set fso=CreateObject("scripting.filesystemobject") Const reboot="/content.cgi?form=M_SAV" IE.menubar=0 '显示IE对象菜单栏 IE.AddressBar=1 '显示IE对象地址栏 IE.ToolBar=0 '显示IE对象工具栏 IE.StatusBar=1 '不显示IE对象状态栏 IE.FullScreen=0 '全屏化IE对象 IE.Height=768 IE.Width=1024 IE.Resizable=1 '设置IE对象大小是否可以被改动 IE.visible=1 '设置是否可见  'IE.Navigate "192.168.46.3" '==============读Config配置文件=========      filepath=createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path file_config=filepath&"\config.ini" Set file=fso.OpenTextFile(file_config,1)      '===========取第一行数据:号码============== OneLine=file.ReadLine OneLineStr=Split(OneLine,"=") OneLineCount=UBound(split(OneLine,"=")) 'MsgBox OneLineStr(1)                         '===============取第二行数据:密码=========== TwoLine=file.ReadLine TwoLineStr=Split(TwoLine,"=") TwoLineCount=UBound(split(TwoLine,"=")) 'MsgBox TwoLineStr(1)      '===============取第三行数据:VOIP服务地址============ ThreeLine=file.ReadLine ThreeLineStr=Split(ThreeLine,"=") ThreeLineCount=UBound(split(ThreeLine,"=")) 'MsgBox ThreeLineStr(1)      '===============取第四行数据:对讲设备地址============ FourLine=file.ReadLine FourLineStr=Split(FourLine,"=") FourLineCount=UBound(split(FourLine,"=")) 'MsgBox FourLineStr(1)      '===============取第五行数据:浏览器安装目录============ FiveLine=file.ReadLine FiveLineStr=Split(FiveLine,"=") FiveLineCount=UBound(split(FiveLine,"=")) 'MsgBox FiveLineStr(1)      'MainWeb() Main() '================================================== Function Main()     IE.Navigate FourLineStr(1)              Do          WScript.Sleep 500              Loop Until IE.ReadyState=4               Login()     SipSetting()     InputParm()     VOIP()     RebootSys() End Function  '====================================================== '登录系统 Function Login()     WScript.Sleep 1000     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys "admin"     ws.SendKeys "{TAB}"     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys "admin"     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{ENTER}" End Function  '================================================ '进入sipsetting菜单 Function SipSetting()     If IE.ReadyState=4 Then               WScript.Sleep 1000         ws.SendKeys "{TAB 5}"         WScript.Sleep 500         ws.SendKeys "{ENTER}"         WScript.Sleep 500         ws.SendKeys "{TAB}"         WScript.Sleep 500         ws.SendKeys "{ENTER}"         WScript.Sleep 2000     Else            MsgBox "进入配置界面失败!"           End If  End Function  '============================================= '切换输入界面 Function InputParm()     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200         ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "{TAB}"     WScript.Sleep 200               ws.SendKeys "{DOWN}"  '选择开启状态     WScript.Sleep 300 End Function  '========================================= '配置参数 Function VOIP()     ws.SendKeys "{TAB}"     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys OneLineStr(1)  'display name          ws.SendKeys "{TAB}"     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys OneLineStr(1)   'user number          ws.SendKeys "{TAB}"     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys OneLineStr(1)   'auth id          ws.SendKeys "{TAB}"         WScript.Sleep 200     ws.SendKeys "^a"     WScript.Sleep 200                 ws.SendKeys TwoLineStr(1)   'password          ws.SendKeys "{TAB}"     WScript.Sleep 200     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys ThreeLineStr(1)   'proxy ip          ws.SendKeys "{TAB}"        'domain     WScript.Sleep 200     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys ThreeLineStr(1)          '=============保存===========     ws.SendKeys "{TAB 48}"     WScript.Sleep 500     ws.SendKeys "{TAB}"     WScript.Sleep 500     ws.SendKeys "{ENTER}"     WScript.Sleep 1500      End Function  '======================================================== '修改参数后重启 Function RebootSys()     WScript.Sleep 500     ws.SendKeys "{F4}"     WScript.Sleep 500     ws.SendKeys "^a"     WScript.Sleep 200     ws.SendKeys FourLineStr(1)&reboot           WScript.Sleep 500          '   Set test=IE.document.getElementsByTagName ("Button")     ws.SendKeys "{ENTER}"          WScript.Sleep 2000          Set ALL = Ie.Document.getElementsByTagName("input")  '检测网页元素是否标签为input,且值等于Reboot     For Each i In ALL     If i.value="Reboot" Then        'i.Click  '点击reboot按钮   

以上就是VBS一键配置VOIP脚本代码的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 脚本专栏