千家信息网

VBS一键配置VOIP脚本代码怎么写

发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,这篇文章给大家介绍VBS一键配置VOIP脚本代码怎么写,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。代码比较长,对vbs感兴趣的朋友可以参考一下Dim ws,fso,IESet 
千家信息网最后更新 2026年11月02日VBS一键配置VOIP脚本代码怎么写

这篇文章给大家介绍VBS一键配置VOIP脚本代码怎么写,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

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

Dim ws,fso,IESet 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=768IE.Width=1024IE.Resizable=1 '设置IE对象大小是否可以被改动IE.visible=1 '设置是否可见 'IE.Navigate "192.168.46.3"'==============读Config配置文件=========    filepath=createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Pathfile_config=filepath&"\config.ini"Set file=fso.OpenTextFile(file_config,1)    '===========取第一行数据:号码==============OneLine=file.ReadLineOneLineStr=Split(OneLine,"=")OneLineCount=UBound(split(OneLine,"="))'MsgBox OneLineStr(1)                       '===============取第二行数据:密码===========TwoLine=file.ReadLineTwoLineStr=Split(TwoLine,"=")TwoLineCount=UBound(split(TwoLine,"="))'MsgBox TwoLineStr(1)    '===============取第三行数据:VOIP服务地址============ThreeLine=file.ReadLineThreeLineStr=Split(ThreeLine,"=")ThreeLineCount=UBound(split(ThreeLine,"="))'MsgBox ThreeLineStr(1)    '===============取第四行数据:对讲设备地址============FourLine=file.ReadLineFourLineStr=Split(FourLine,"=")FourLineCount=UBound(split(FourLine,"="))'MsgBox FourLineStr(1)    '===============取第五行数据:浏览器安装目录============FiveLine=file.ReadLineFiveLineStr=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 300End 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按钮               WScript.Sleep 1000               Ie.Document.parentwindow.execScript("top.location='content.cgi?_method_=reboot'")  '直接执行reboot确认操作        Exit For         End If    Next        WScript.Sleep 3000            MsgBox "配置已完成,设备正在重启,请耐心等待...",,"提示"    If ws.AppActivate("来自网页的消息") Then                 ws.SendKeys "{ENTER}"        WScript.Sleep 2000                MsgBox "配置已完成,设备正在重启,请耐心等待...",,"提示"            Else         'MsgBox "配置未成功,请重新检查配置!",,"提示"            End If End Function '====================================================================Function MainWeb()    '=============启动地址====================='方式一:自定义浏览器启动,需配置路径'   Function login()        '       ws.run FiveLineStr(1)'       WScript.Sleep 3000'       ws.SendKeys "{F4}"'       WScript.Sleep 200'       ws.SendKeys "^a"'       WScript.Sleep 500'       ws.SendKeys FourLineStr(1)'       WScript.Sleep 500'       ws.SendKeys "{ENTER}"                '   End Function    '方式二:用系统默认浏览器启动     ws.Run FourLineStr(1)    '===============登录设备=====================    WScript.Sleep 5000    ws.SendKeys "^a"    WScript.Sleep 200    ws.SendKeys "admin"    ws.SendKeys "{TAB}"    ws.SendKeys "^a"    WScript.Sleep 200    ws.SendKeys "admin"    ws.SendKeys "{ENTER}"        '============进入sip setting菜单=============    WScript.Sleep 2000    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            '==============进入编辑状态=======================    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        '==============配置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    '===============重启==========        ws.SendKeys "{TAB 18}"    WScript.Sleep 1000    ws.SendKeys "{ENTER}"    WScript.Sleep 1000    ws.SendKeys "{TAB 2}"    WScript.Sleep 500    ws.SendKeys "{ENTER}"    WScript.Sleep 1000        If ws.AppActivate("来自网页的消息") Then             ws.SendKeys "{ENTER}"        WScript.Sleep 1000                MsgBox "配置已完成,设备正在重启,请耐心等待...",,"提示"            Else         MsgBox "配置未成功,请重新检查配置!",,"提示"            End If End Function Set ws=Nothing Set IE=Nothing Set fso=Nothing 

网页部分JS代码:

 

关于VBS一键配置VOIP脚本代码怎么写就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

配置 对象 数据 设备 提示 代码 地址 状态 网页 耐心 正在 浏览器 菜单 浏览 脚本 一键 成功 兴趣 内容 参数 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 科技创新与互联网经济 以房互联网科技 银优互联网科技有限公司 汇久创客互联网科技 互联网女皇 腾讯科技 左右互联网络科技 太原新华互联网科技学校怎么样 银川新华互联网科技学校地址 开启互联网科技时代小说 深圳市运趣互联网科技有限公司 互联网与医疗科技 互联网科技与大数据专业 工业互联网等科技实现智能化赋能 互联网科技如何创业 保险科技服务互联网营销体系 上海京穆互联网科技有限公司 全球科技与互联网公司市值变化 科技信息时代互联网发展 互联网科技对化妆品行业 互联网科技大会大佬 唐信互联网科技 大连 中正互联网科技招聘 湖南一路畅行互联网科技 烟台灵鸽互联网科技有限公司 滨湖区互联网智能科技产品有哪些 互联网时代的科技公司 众安科技工业互联网合作 山东星卡互联网科技有限公司官网 互联网科技企业商标注意事项 互联网科技大佬云集
0