Something that I'd like to share with you!

Saturday, July 05, 2008

Web Based HTTP management GUI

No comments :
When receiving a call from friend ask your help on "Hey! how do I open my ADSL modem Web Based HTTP management GUI?" and your answer "Oh! Go to command prompt and then type ipconfig or route PRINT and hit enter. Copy the gateway IP address in format, Paste it at your Internet browser URL bar and hit enter" Suddenly he/she might ask you back, "What is command prompt?" or "How does IP address looks like?" or "I enter ipconfig at the command prompt but I get this response ip is not recognized as an internal or external command what went wrong?" (Maybe he/she type "ip config" with space instead of "ipconfig").

Then you should consider pass him/her below script. Script below automates process above so with a double click he/she could open the Web Based HTTP management GUI with default Internet browser.

Option Explicit

Dim oShell
Dim oShellExec
Dim oStdOutputText, sText, strTarget, strPingResults

Set oShell = CreateObject("Wscript.Shell")

Set oShellExec = oShell.Exec("%comspec% /c route print")
set oStdOutputText = oShellExec.StdOut

Do While Not oStdOutputText.AtEndOfStream
sText = oStdOutputText.ReadLine
If InStr(sText, "Default Gateway") <> 0 Then
strTarget = split(sText,":")
exit do
End If

Set oShellExec = oShell.Exec("%comspec% /c ping -n 1 " & strTarget(1))
strPingResults = LCase(oShellExec.StdOut.ReadAll)

If InStr(strPingResults, "reply from") Then
Set oShellExec = oShell.Exec("%comspec% /c start http://" & trim(strTarget(1)))
WScript.Echo "******** Local router is DOWN ********"
End If

Set oShellExec = Nothing

Copy and paste above codes into notepad and name it as open_modem_gui.vbs. Note that the extension must be *.vbs.

IF he/she asked you "Hey it prompts for password now. How?" just ask him/her to refer to the ADSL modem user manual.

No comments :