Click here to Skip to main content
15,888,263 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 Check

Dim oShell,oEnvironment, intRow, stoarcode, stonum, Popwindow, objExcel, sys, Eror, Disp, stoloc
set 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 = 2
x = 1

Do Until objExcel.Cells(intRow,1).Value = ""
stonum = objExcel.Cells(intRow,1).Value
WScript.Sleep 2000
oShell.run "hypertrm"
WScript.Sleep 1000

Popwindow = sys.GetActiveWindowTitle()

oShell.appactivate "Connection Description"

If Popwindow = "Connection Description" Then

oShell.SendKeys("TAD-OOB")
oShell.SendKeys("{Enter}")
WScript.Sleep 1000

oShell.appactivate "Connect To"
oShell.SendKeys("%p")
oShell.SendKeys(stonum)
WScript.Sleep 1000
oShell.SendKeys("{Enter}")
WScript.Sleep 200
oShell.SendKeys("%m")
WScript.Sleep 200
oShell.SendKeys("%u")
WScript.Sleep 200
oShell.SendKeys("%r")
WScript.Sleep 200
oShell.SendKeys("{Tab}")
WScript.Sleep 200
oShell.SendKeys("{Enter}")
WScript.Sleep 200
oShell.SendKeys("{Enter}")
WScript.Sleep 70000

Popwindow = sys.GetActiveWindowTitle()

If Popwindow = "Connect" Then
WScript.Sleep 3000
oShell.SendKeys("{ESCAPE}")
WScript.Sleep 2000
oShell.SendKeys("%fx")
WScript.Sleep 1000
oShell.SendKeys("n")
WScript.Echo "Number : " & stoarcode & stonum & " is Offline"

ElseIf Popwindow = "HyperTerminal" Then

oShell.AppActivate "HyperTerminal"
oShell.SendKeys("{Enter}")
WScript.Sleep 800
oShell.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 Then
MsgBox("Script Stopped")
Exit Do
End if
oShell.SendKeys("%fx")
WScript.Sleep 1000
oShell.SendKeys("n")

ElseIf Popwindow = "TAD-OOB - HyperTerminal" Then

WScript.Sleep 5000
oShell.appactivate "TAD-OOB - HyperTerminal"
oShell.SendKeys("root")
WScript.Sleep 2000
oShell.SendKeys("{Enter}")
WScript.Sleep 5000
oShell.SendKeys("B!@ckD1y")
WScript.Sleep 10000
oShell.SendKeys("{Enter}")
WScript.Sleep 5000
oShell.SendKeys("{Enter}")
WScript.Sleep 5000
oShell.SendKeys("T")
oShell.SendKeys("{Enter}")
WScript.Sleep 10000
oShell.SendKeys("%fx")
WScript.Sleep 3000
oShell.SendKeys("y")
WScript.Sleep 2000
oShell.SendKeys("n")
WScript.Sleep 2000
oShell.SendKeys("{ESCAPE}")

WScript.Echo " Number : " & stoarcode & stonum & " is reachable"

ElseIf Popwindow = "HyperTerminal Applet" Then
WScript.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 Then
MsgBox("Script Stopped")
Exit Do
End if
WScript.Sleep 10000

End If
Else
Eror = 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 Then
Disp = MsgBox("Click 'OK'", 512, "Script Stopped")
Exit Do
End if
End If
WScript.Sleep 1000
intRow = intRow + 1
WScript.Sleep 1500
Loop

objExcel.Application.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
Set oShell = Nothing

Disp = MsgBox("Please check the logs for Output", 512, "Script completed dailing")
WScript.Quit()
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900