intRow = intRow + 1 WScript.Sleep 1500 循环 objExcel.Application .Quit 设置objWorkbook =没什么 设置objExcel =没什么 设置oShell =没什么 Disp = MsgBox(请检查日志输出,512,脚本完成dailing) WScript.Quit()解决方案 Hi Guys,I have been struggling with the below VBS from past few days. Its basically used for checking the dial up connectivity through hyperterminal. It was working fine on WIN XP but now i have migrated to WIN7 (x64) and it has stopped working.I would like to request you guys to either advice me for the break fix to run it on WIN7(x64) or any better script wich serves the same purpose.' OOB Connectivity CheckDim oShell,oEnvironment, intRow, stoarcode, stonum, Popwindow, objExcel, sys, Eror, Disp, stolocset oShell = CreateObject("WScript.Shell")Set objExcel = CreateObject("Excel.Application")Set objWorkbook = objExcel.Workbooks.Open _ ("C:\TAD\New_users.xls")Set sys=createobject("jssys3.ops")intRow = 2x = 1Do Until objExcel.Cells(intRow,1).Value = ""stonum = objExcel.Cells(intRow,1).ValueWScript.Sleep 2000oShell.run "hypertrm"WScript.Sleep 1000Popwindow = sys.GetActiveWindowTitle()oShell.appactivate "Connection Description"If Popwindow = "Connection Description" ThenoShell.SendKeys("TAD-OOB")oShell.SendKeys("{Enter}")WScript.Sleep 1000oShell.appactivate "Connect To"oShell.SendKeys("%p")oShell.SendKeys(stonum)WScript.Sleep 1000oShell.SendKeys("{Enter}")WScript.Sleep 200oShell.SendKeys("%m")WScript.Sleep 200oShell.SendKeys("%u")WScript.Sleep 200oShell.SendKeys("%r")WScript.Sleep 200oShell.SendKeys("{Tab}")WScript.Sleep 200oShell.SendKeys("{Enter}")WScript.Sleep 200oShell.SendKeys("{Enter}")WScript.Sleep 70000Popwindow = sys.GetActiveWindowTitle()If Popwindow = "Connect" ThenWScript.Sleep 3000oShell.SendKeys("{ESCAPE}")WScript.Sleep 2000oShell.SendKeys("%fx")WScript.Sleep 1000oShell.SendKeys("n")WScript.Echo "Number : " & stoarcode & stonum & " is Offline"ElseIf Popwindow = "HyperTerminal" ThenoShell.AppActivate "HyperTerminal"oShell.SendKeys("{Enter}")WScript.Sleep 800oShell.AppActivate "HyperTerminal"oShell.SendKeys("{Enter}")MsgBox("Please enter the dail-up number")WScript.Echo "Please enter a dail-up number in the input file"Eror = MsgBox ("Click 'OK' to continue else 'CANCEL' to stop the script and please check the dailup number list", 1, "Invalid number")oShell.AppActivate "Invalid number"If Eror = 2 ThenMsgBox("Script Stopped")Exit DoEnd ifoShell.SendKeys("%fx")WScript.Sleep 1000oShell.SendKeys("n")ElseIf Popwindow = "TAD-OOB - HyperTerminal" ThenWScript.Sleep 5000oShell.appactivate "TAD-OOB - HyperTerminal"oShell.SendKeys("root")WScript.Sleep 2000oShell.SendKeys("{Enter}")WScript.Sleep 5000oShell.SendKeys("B!@ckD1y")WScript.Sleep 10000oShell.SendKeys("{Enter}")WScript.Sleep 5000oShell.SendKeys("{Enter}")WScript.Sleep 5000oShell.SendKeys("T")oShell.SendKeys("{Enter}")WScript.Sleep 10000oShell.SendKeys("%fx")WScript.Sleep 3000oShell.SendKeys("y")WScript.Sleep 2000oShell.SendKeys("n")WScript.Sleep 2000oShell.SendKeys("{ESCAPE}")WScript.Echo " Number : " & stoarcode & stonum & " is reachable"ElseIf Popwindow = "HyperTerminal Applet" ThenWScript.Echo "Script Encountered Error while dailing " & stoarcode & stonum & ""WScript.Echo "Please stop the script"Eror = MsgBox ("Click 'OK' to STOP 'Cancel' to CONTINUE", 1,"Error - Stop the script")oShell.AppActivate "Error - Stop the script"If Eror = 1 ThenMsgBox("Script Stopped")Exit DoEnd ifWScript.Sleep 10000End IfElseEror = MsgBox ("Error running Hyper Terminal. Click 'OK' to STOP 'Cancel' to CONTINUE", 1, "Error - Stop the script")oShell.AppActivate "Error - Stop the script"WScript.Echo "Script Encountered Error while dailing " & stoarcode & stonum & ""If Eror = 1 ThenDisp = MsgBox("Click 'OK'", 512, "Script Stopped")Exit DoEnd ifEnd IfWScript.Sleep 1000intRow = intRow + 1WScript.Sleep 1500LoopobjExcel.Application.QuitSet objWorkbook = NothingSet objExcel = NothingSet oShell = NothingDisp = MsgBox("Please check the logs for Output", 512, "Script completed dailing")WScript.Quit() 解决方案 这篇关于VBScript问题修复!!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 18:14