I have a netgear wireless card, which has little to no support for automaticly switching networks…
So, I wrote yet another script. This time I went overboard and even made it connect to my Internode DSL
I don’t know how usefull this is or would be to you but, it might have some code in it that you can use.
; Name of your DSL connection
$DSL = "Internode"
; Username for your DSL connection
$Username = "customer@internode.on.net"
; Password for your DSN connection
$Password = "password"
AutoItSetOption("TrayIconHide","1")
dim $arr[900]
$arr[600] = "An operation is pending"
$arr[601] = "An invalid port handle was detected"
$arr[602] = "The specified port is already open"
$arr[603] = "The caller's buffer is too small"
$arr[604] = "Incorrect information was specified"
$arr[605] = "The port information cannot be set"
$arr[606] = "The specified port is not connected"
$arr[607] = "An invalid event is detected"
$arr[608] = "A device was specified that does not exist"
$arr[609] = "The device type was specified that does not exist"
$arr[610] = "An invalid buffer was specified"
$arr[611] = "A route was specified that is not available"
$arr[612] = "A route was specified that is not allocated"
$arr[613] = "An invalid compression was specified "
$arr[614] = "There were insufficient buffers available"
$arr[615] = "The specified port was not found"
$arr[616] = "An asynchronous request is pending"
$arr[617] = "The modem is already disconnecting"
$arr[618] = "The specified port is not open"
$arr[619] = "The specified port is not connected"
$arr[620] = "No endpoints could be determined"
$arr[621] = "The system could not open the phonebook"
$arr[622] = "The system could not load the phonebook"
$arr[623] = "The system could not find the phonebook entry for this connection"
$arr[624] = "The system could not update the phonebook file"
$arr[625] = "The system found invalid information in the phonebook"
$arr[626] = "A string could not be loaded"
$arr[627] = "A key could not be found"
$arr[628] = "The connection was closed"
$arr[629] = "The connection was closed by the remote computer"
$arr[630] = "The modem was disconnected due to hardware failure"
$arr[631] = "The user disconnected the modem"
$arr[632] = "An incorrect structure size was detected"
$arr[633] = "The modem is already in use or is not configured for dialing out"
$arr[634] = "Your computer could not be registered on the remote network"
$arr[635] = "There was an unknown error"
$arr[636] = "The device attached to the port is not the one expected"
$arr[637] = "A string was detected that could not be converted"
$arr[638] = "The request has timed out"
$arr[639] = "No asynchronous net is available"
$arr[640] = "A error has occurred involving NetBIOS"
$arr[641] = "The server cannot allocate NetBIOS resources needed to support the client"
$arr[642] = "One of your computer's NetBIOS names is already registered on the remote network"
$arr[643] = "A network adapter at the server failed"
$arr[644] = "You will not receive network message popups"
$arr[645] = "There was an internal authentication error"
$arr[646] = "The account is not permitted to log on at this time of day"
$arr[647] = "The account is disabled "
$arr[648] = "The password for this account has expired"
$arr[649] = "The account does not have permission to dial in"
$arr[650] = "The remote access server is not responding"
$arr[651] = "The modem has reported an error"
$arr[652] = "There was an unrecognized response from the modem"
$arr[653] = "A macro required by the modem was not found in the device .INF file section"
$arr[654] = "A command or response in the device .INF file section refers to an undefined macro"
$arr[655] = "The <MESSAGE> macro was not found in the device .INF file section"
$arr[656] = "The <DEFAULTOFF> macro in the device .INF file section contains an undefined macro"
$arr[657] = "The device .INF file could not be opened"
$arr[658] = "The device name in the device .INF or media .INI file is too long"
$arr[659] = "The media .INI file refers to an unknown device name"
$arr[660] = "The device .INF file contains no responses for the command"
$arr[661] = "The device .INF file is missing a command"
$arr[662] = "there was an attempt to set a macro not listed in the device .INF file section"
$arr[663] = "The media .INI file refers to an unknown device type"
$arr[664] = "The system has run out of memory"
$arr[665] = "The modem is not properly configured"
$arr[666] = "The modem is not functioning"
$arr[667] = "The system was unable to read the media .INI file"
$arr[668] = "The connection was terminated"
$arr[669] = "The usage parameter in the media .INI file is invalid"
$arr[670] = "The system was unable to read the section name from the media .INI file"
$arr[671] = "The system was unable to read the device type from the media .INI file"
$arr[672] = "The system was unable to read the device name from the media .INI file"
$arr[673] = "The system was unable to read the usage from the media .INI file"
$arr[674] = "The system was unable to read the maximum connection BPS rate from the media .INI file"
$arr[675] = "The system was unable to read the maximum carrier connection speed from the media .INI file"
$arr[676] = "The phone line is busy"
$arr[677] = "A person answered instead of a modem "
$arr[678] = "There was no answer"
$arr[679] = "The system could not detect the carrier"
$arr[680] = "There was no dial tone"
$arr[681] = "The modem reported a general error"
$arr[691] = "Access was denied because the user name and/or password was invalid on the domain"
$arr[692] = "There was a hardware failure in the modem"
$arr[695] = "The state machines are not started "
$arr[696] = "The state machines are already started"
$arr[697] = "The response looping did not complete"
$arr[699] = "The modem response caused a buffer overflow"
$arr[700] = "The expanded command in the device .INF file is too long"
$arr[701] = "The modem moved to a connection speed not supported by the COM driver"
$arr[703] = "The connection needs information from you, but the application does not allow user interaction"
$arr[704] = "The callback number is invalid"
$arr[705] = "The authorization state is invalid"
$arr[707] = "There was an error related to the X.25 protocol "
$arr[708] = "The account has expired"
$arr[709] = "There was an error changing the password on the domain. The password might have been ..."
$arr[710] = "Serial overrun errors were detected while communicating with the modem"
$arr[711] = "The Remote Access Service Manager could not start. Additional information is provided in ....."
$arr[712] = "The two-way port is initializing. Wait a few seconds and redial"
$arr[713] = "No active ISDN lines are available"
$arr[714] = "No ISDN channels are available to make the call"
$arr[715] = "Too many errors occurred because of poor phone line quality"
$arr[716] = "The remote access service IP configuration is unusable"
$arr[717] = "No IP addresses are available in the static pool of remote access service IP addresses"
$arr[718] = "The connection timed out waiting for a valid response from the remote computer"
$arr[719] = "The connection was terminated by the remote computer"
$arr[720] = "The connection attempt failed because your computer and the remote computer could not ....."
$arr[721] = "The remote computer is not responding"
$arr[722] = "Invalid data was received from the remote computer. This data was ignored"
$arr[723] = "The phone number, including prefix and suffix, is too long"
$arr[726] = "The IPX protocol cannot be used for dial-out on more than one modem at a time"
$arr[728] = "The system cannot find an IP adapter"
$arr[729] = "SLIP cannot be used unless the IP protocol is installed"
$arr[731] = "The protocol is not configured"
$arr[732] = "Your computer and the remote computer could not agree on PPP control protocols"
$arr[733] = "Your computer and the remote computer could not agree on PPP control protocols"
$arr[734] = "The PPP link control protocol was terminated"
$arr[735] = "The requested address was rejected by the server"
$arr[736] = "The remote computer terminated the control protocol "
$arr[737] = "Loopback detected"
$arr[738] = "The server did not assign an address"
$arr[739] = "The authentication protocol required by the remote server cannot use the stored password. ....."
$arr[740] = "An invalid dialing rule was detected"
$arr[741] = "The local computer does not support the required data encryption type"
$arr[742] = "The remote computer does not support the required data encryption type"
$arr[743] = "The remote server requires data encryption"
$arr[751] = "The callback number contains an invalid character. Only the following characters are ....."
$arr[752] = "A syntax error was encountered while processing a script"
$arr[753] = "The connection could not be disconnected because it was created by the multi-protocol router"
$arr[754] = "The system could not find the multi-link bundle"
$arr[755] = "The system cannot perform automated dial because this entry has a custom dialer specified"
$arr[756] = "This connection is already being dialed"
$arr[757] = "Remote access services could not be started automatically. Additional information is ....."
$arr[758] = "Internet connection sharing is already enabled on the connection"
$arr[760] = "An error occurred while routing capabilities were being enabled"
$arr[761] = "An error occurred while Internet connection sharing was being enabled for the connection"
$arr[763] = "Internet connection sharing cannot be enabled. There are two or more LAN connections in ....."
$arr[764] = "No smart card reader is installed"
$arr[765] = "Internet connection sharing cannot be enabled. A LAN connection is already configured ....."
$arr[766] = "The system could not find any certificate"
$arr[767] = "Internet connection sharing cannot be enabled. The LAN connection selected on the ....."
$arr[768] = "The connection attempt failed because of failure to encrypt data"
$arr[769] = "The specified destination is not reachable"
$arr[770] = "The remote machine rejected the connection attempt"
$arr[771] = "The connection attempt failed because the network is busy"
$arr[772] = "The remote computer's network hardware is incompatible with the type of call requested"
$arr[773] = "The connection attempt failed because the destination number has changed"
$arr[774] = "The connection attempt failed because of a temporary failure. Try connecting again"
$arr[775] = "The call was blocked by the remote computer"
$arr[776] = "The call could not be connected because the destination has invoked the Do Not Disturb feature"
$arr[777] = "The connection attempt failed because the modem on the remote computer is out of order"
$arr[778] = "It was not possible to verify the identity of the server"
$arr[779] = "To dial out using this connection, you must use a smart card"
$arr[780] = "An attempted function is not valid for this connection"
$arr[781] = "The encryption attempt failed because no valid certificate was found"
SplashTextOn("Autonetwork",@CRLF & @CRLF & "Please wait while I change your wireless network",800,200,-1,-1,0,"",24,500)
run("C:\Program Files\NETGEAR\WG511SCU\Utility\Gear511.exe")
WinWaitActive("NETGEAR WG511T SMART WIZARD - Wireless Assistant")
$cur = ControlGetText("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5")
if ($cur == "Home") then
$new = "Office"
else
$new = "Home"
endif
ControlFocus("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5")
$Ref = ControlCommand("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5","FindString",$new)
ControlCommand("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5","SetCurrentSelection",$Ref)
ControlFocus("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","Button2")
ControlClick("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","Button2")
ControlClick("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","Button4")
Sleep(5000)
$Count = 0
While (@IPAddress1 == '127.0.0.1')
Sleep(100)
$Count = $Count + 1;
if ($Count == 30) then
ExitLoop
endif
WEnd
if (not(@IPAddress1 == '127.0.0.1')) then
if ($new == "Home") then
sleep(2000)
$ret = RunWait( @ComSpec & " /C ""rasdial " & $DSL & " " & $Username & " " & $Password & """", "", @SW_HIDE )
if ($ret > 0) then
SplashOff()
msgbox(48,"Connection to " & $DSL & " Failed",$arr[$ret])
endif
endif
endif
SplashOff()
if (@IPAddress1 == '127.0.0.1') then
msgbox(0,"Autonetwork","It seems that the switch to the " & $new & " network has failed")
endif