VBS 원 키 설정 VOIP 스 크 립 트 코드

12840 단어 VBSVOIP
코드 가 길 어서 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  
       
        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 코드:







 



이 글 은 여기까지 소개 되 었 으 니 앞으로 많은 성원 부 탁 드 리 겠 습 니 다.

좋은 웹페이지 즐겨찾기