Jump to content

Recommended Posts

Posted (edited)

This is a quick script for those with Bell 2Wire modems.

Might have compatibility issues.

[Edited]

I should mention the images are found on the modems homepage, just save each of them.

#include <IE.au3>
#include <Array.au3>
#include <String.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Status_Info[4], $Summary[4] = ["Status", "Network", "Firewall", "Serial"]
 
$Swap = True
 
If $Swap = True Then
$X_Pic = 0
$Y_Pic = 0
$X_Txt = 70
$Y_Txt = 50
$Txt_Static = 20
$Network = GUICreate("", 700, 120, Default, Default, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW)
GUICtrlCreateLabel("", 0, 0, 700, 120, Default, $GUI_WS_EX_PARENTDRAG)
ElseIf $Swap = False Then
;;;Can't be bothered to make it vertical...I have no use for it.
Else
Exit
EndIf
 
For $Loop = 0 To 3 Step +1
GUICtrlCreatePic(@ScriptDir & "\Sum_" & $Loop & ".jpg", $X_Pic, $Y_Pic, 62, 108)
$Sum = GUICtrlCreateLabel($Summary[$Loop], $X_Txt, $Txt_Static, 100, 25)
GUICtrlSetFont($Sum, Default, 800)
$Status_Info[$Loop] = GUICtrlCreateLabel("Please Wait...", $X_Txt, $Y_Txt, 100, 50)
$X_Pic += 170
$X_Txt += 170
Next
 
GUISetState(@SW_HIDE)
_Info()
GUISetState(@SW_SHOW)
 
AdlibRegister("_Info", 10000) ; Refresh Speed
 
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
 
Func _Info()
$Perm_Link = "http://gateway.2wire.net/"
 
$oIE = _IECreate($Perm_Link, 0, 0, 1, 0) ; No need to ping (Direct Access)
$Source = _IEBodyReadHTML($oIE)
$IE_Info_0 = _StringBetween($Source, '<td>Status<br>', '</td>') ; Connection
$IE_Info_1 = _StringBetween($Source, '<p class="large">Network name <br>', '</p>') ; Network
$IE_Info_2 = _StringBetween($Source, '<p class="large">Status<br>', '</p>') ; Firewall
$IE_Info_3 = _StringBetween($Source, '<p class="large">Serial number:<br>', '</p>') ; Gateway
GUICtrlSetData($Status_Info[0] , $IE_Info_0[0])
If @Error Then _Error(0)
GUICtrlSetData($Status_Info[1] , $IE_Info_1[0])
If @Error Then _Error(1)
GUICtrlSetData($Status_Info[2] , $IE_Info_2[0])
If @Error Then _Error(2)
GUICtrlSetData($Status_Info[3] , $IE_Info_3[0])
If @Error Then _Error(3)
 
_IEQuit($oIE)
EndFunc
 
Func _Error($Code)
If $Code = 0 Then
MsgBox(16, "Error 100", "Now Exiting...")
ElseIf $Code = 1 Then
MsgBox(16, "Error 101", "Now Exiting...")
ElseIf $Code = 2 Then
MsgBox(16, "Error 102", "Now Exiting...")
ElseIf $Code = 3 Then
MsgBox(16, "Error 103", "Now Exiting...")
Else
MsgBox(16, "Debug", "Now Exiting...")
EndIf
EndFunc
Edited by SkellySoul

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...