IPv4 Fremnet Logo
TOOLS, TINKERINGS & CODE

Appreciate me

Wireless Network Switching · Mar 13, 20:38 by Shannon Wynter

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.

  1. ; Name of your DSL connection
  2. $DSL = "Internode"
  3.  
  4. ; Username for your DSL connection
  5. $Username = "customer@internode.on.net"
  6.  
  7. ; Password for your DSN connection
  8.  
  9. $Password = "password"
  10.  
  11. AutoItSetOption("TrayIconHide","1")
  12.  
  13. dim $arr[900]
  14.  
  15. $arr[600] = "An operation is pending"
  16. $arr[601] = "An invalid port handle was detected"
  17. $arr[602] = "The specified port is already open"
  18. $arr[603] = "The caller's buffer is too small"
  19. $arr[604] = "Incorrect information was specified"
  20. $arr[605] = "The port information cannot be set"
  21. $arr[606] = "The specified port is not connected"
  22. $arr[607] = "An invalid event is detected"
  23. $arr[608] = "A device was specified that does not exist"
  24. $arr[609] = "The device type was specified that does not exist"
  25. $arr[610] = "An invalid buffer was specified"
  26. $arr[611] = "A route was specified that is not available"
  27. $arr[612] = "A route was specified that is not allocated"
  28. $arr[613] = "An invalid compression was specified "
  29. $arr[614] = "There were insufficient buffers available"
  30. $arr[615] = "The specified port was not found"
  31. $arr[616] = "An asynchronous request is pending"
  32. $arr[617] = "The modem is already disconnecting"
  33. $arr[618] = "The specified port is not open"
  34. $arr[619] = "The specified port is not connected"
  35. $arr[620] = "No endpoints could be determined"
  36. $arr[621] = "The system could not open the phonebook"
  37. $arr[622] = "The system could not load the phonebook"
  38. $arr[623] = "The system could not find the phonebook entry for this connection"
  39. $arr[624] = "The system could not update the phonebook file"
  40. $arr[625] = "The system found invalid information in the phonebook"
  41. $arr[626] = "A string could not be loaded"
  42. $arr[627] = "A key could not be found"
  43. $arr[628] = "The connection was closed"
  44. $arr[629] = "The connection was closed by the remote computer"
  45. $arr[630] = "The modem was disconnected due to hardware failure"
  46. $arr[631] = "The user disconnected the modem"
  47. $arr[632] = "An incorrect structure size was detected"
  48. $arr[633] = "The modem is already in use or is not configured for dialing out"
  49. $arr[634] = "Your computer could not be registered on the remote network"
  50. $arr[635] = "There was an unknown error"
  51. $arr[636] = "The device attached to the port is not the one expected"
  52. $arr[637] = "A string was detected that could not be converted"
  53. $arr[638] = "The request has timed out"
  54. $arr[639] = "No asynchronous net is available"
  55. $arr[640] = "A error has occurred involving NetBIOS"
  56. $arr[641] = "The server cannot allocate NetBIOS resources needed to support the client"
  57. $arr[642] = "One of your computer's NetBIOS names is already registered on the remote network"
  58. $arr[643] = "A network adapter at the server failed"
  59. $arr[644] = "You will not receive network message popups"
  60. $arr[645] = "There was an internal authentication error"
  61. $arr[646] = "The account is not permitted to log on at this time of day"
  62. $arr[647] = "The account is disabled "
  63. $arr[648] = "The password for this account has expired"
  64. $arr[649] = "The account does not have permission to dial in"
  65. $arr[650] = "The remote access server is not responding"
  66. $arr[651] = "The modem has reported an error"
  67. $arr[652] = "There was an unrecognized response from the modem"
  68. $arr[653] = "A macro required by the modem was not found in the device .INF file section"
  69. $arr[654] = "A command or response in the device .INF file section refers to an undefined macro"
  70. $arr[655] = "The <MESSAGE> macro was not found in the device .INF file section"
  71. $arr[656] = "The <DEFAULTOFF> macro in the device .INF file section contains an undefined macro"
  72. $arr[657] = "The device .INF file could not be opened"
  73. $arr[658] = "The device name in the device .INF or media .INI file is too long"
  74. $arr[659] = "The media .INI file refers to an unknown device name"
  75. $arr[660] = "The device .INF file contains no responses for the command"
  76. $arr[661] = "The device .INF file is missing a command"
  77. $arr[662] = "there was an attempt to set a macro not listed in the device .INF file section"
  78. $arr[663] = "The media .INI file refers to an unknown device type"
  79. $arr[664] = "The system has run out of memory"
  80. $arr[665] = "The modem is not properly configured"
  81. $arr[666] = "The modem is not functioning"
  82. $arr[667] = "The system was unable to read the media .INI file"
  83. $arr[668] = "The connection was terminated"
  84. $arr[669] = "The usage parameter in the media .INI file is invalid"
  85. $arr[670] = "The system was unable to read the section name from the media .INI file"
  86. $arr[671] = "The system was unable to read the device type from the media .INI file"
  87. $arr[672] = "The system was unable to read the device name from the media .INI file"
  88. $arr[673] = "The system was unable to read the usage from the media .INI file"
  89. $arr[674] = "The system was unable to read the maximum connection BPS rate from the media .INI file"
  90. $arr[675] = "The system was unable to read the maximum carrier connection speed from the media .INI file"
  91. $arr[676] = "The phone line is busy"
  92. $arr[677] = "A person answered instead of a modem "
  93. $arr[678] = "There was no answer"
  94. $arr[679] = "The system could not detect the carrier"
  95. $arr[680] = "There was no dial tone"
  96. $arr[681] = "The modem reported a general error"
  97. $arr[691] = "Access was denied because the user name and/or password was invalid on the domain"
  98. $arr[692] = "There was a hardware failure in the modem"
  99. $arr[695] = "The state machines are not started "
  100. $arr[696] = "The state machines are already started"
  101. $arr[697] = "The response looping did not complete"
  102. $arr[699] = "The modem response caused a buffer overflow"
  103. $arr[700] = "The expanded command in the device .INF file is too long"
  104. $arr[701] = "The modem moved to a connection speed not supported by the COM driver"
  105. $arr[703] = "The connection needs information from you, but the application does not allow user interaction"
  106. $arr[704] = "The callback number is invalid"
  107. $arr[705] = "The authorization state is invalid"
  108. $arr[707] = "There was an error related to the X.25 protocol "
  109. $arr[708] = "The account has expired"
  110. $arr[709] = "There was an error changing the password on the domain. The password might have been ..."
  111. $arr[710] = "Serial overrun errors were detected while communicating with the modem"
  112. $arr[711] = "The Remote Access Service Manager could not start. Additional information is provided in ....."
  113. $arr[712] = "The two-way port is initializing. Wait a few seconds and redial"
  114. $arr[713] = "No active ISDN lines are available"
  115. $arr[714] = "No ISDN channels are available to make the call"
  116. $arr[715] = "Too many errors occurred because of poor phone line quality"
  117. $arr[716] = "The remote access service IP configuration is unusable"
  118. $arr[717] = "No IP addresses are available in the static pool of remote access service IP addresses"
  119. $arr[718] = "The connection timed out waiting for a valid response from the remote computer"
  120. $arr[719] = "The connection was terminated by the remote computer"
  121. $arr[720] = "The connection attempt failed because your computer and the remote computer could not ....."
  122. $arr[721] = "The remote computer is not responding"
  123. $arr[722] = "Invalid data was received from the remote computer. This data was ignored"
  124. $arr[723] = "The phone number, including prefix and suffix, is too long"
  125. $arr[726] = "The IPX protocol cannot be used for dial-out on more than one modem at a time"
  126. $arr[728] = "The system cannot find an IP adapter"
  127. $arr[729] = "SLIP cannot be used unless the IP protocol is installed"
  128. $arr[731] = "The protocol is not configured"
  129. $arr[732] = "Your computer and the remote computer could not agree on PPP control protocols"
  130. $arr[733] = "Your computer and the remote computer could not agree on PPP control protocols"
  131. $arr[734] = "The PPP link control protocol was terminated"
  132. $arr[735] = "The requested address was rejected by the server"
  133. $arr[736] = "The remote computer terminated the control protocol "
  134. $arr[737] = "Loopback detected"
  135. $arr[738] = "The server did not assign an address"
  136. $arr[739] = "The authentication protocol required by the remote server cannot use the stored password. ....."
  137. $arr[740] = "An invalid dialing rule was detected"
  138. $arr[741] = "The local computer does not support the required data encryption type"
  139. $arr[742] = "The remote computer does not support the required data encryption type"
  140. $arr[743] = "The remote server requires data encryption"
  141. $arr[751] = "The callback number contains an invalid character. Only the following characters are ....."
  142. $arr[752] = "A syntax error was encountered while processing a script"
  143. $arr[753] = "The connection could not be disconnected because it was created by the multi-protocol router"
  144. $arr[754] = "The system could not find the multi-link bundle"
  145. $arr[755] = "The system cannot perform automated dial because this entry has a custom dialer specified"
  146. $arr[756] = "This connection is already being dialed"
  147. $arr[757] = "Remote access services could not be started automatically. Additional information is ....."
  148. $arr[758] = "Internet connection sharing is already enabled on the connection"
  149. $arr[760] = "An error occurred while routing capabilities were being enabled"
  150. $arr[761] = "An error occurred while Internet connection sharing was being enabled for the connection"
  151. $arr[763] = "Internet connection sharing cannot be enabled. There are two or more LAN connections in ....."
  152. $arr[764] = "No smart card reader is installed"
  153. $arr[765] = "Internet connection sharing cannot be enabled. A LAN connection is already configured ....."
  154. $arr[766] = "The system could not find any certificate"
  155. $arr[767] = "Internet connection sharing cannot be enabled. The LAN connection selected on the ....."
  156. $arr[768] = "The connection attempt failed because of failure to encrypt data"
  157. $arr[769] = "The specified destination is not reachable"
  158. $arr[770] = "The remote machine rejected the connection attempt"
  159. $arr[771] = "The connection attempt failed because the network is busy"
  160. $arr[772] = "The remote computer's network hardware is incompatible with the type of call requested"
  161. $arr[773] = "The connection attempt failed because the destination number has changed"
  162. $arr[774] = "The connection attempt failed because of a temporary failure. Try connecting again"
  163. $arr[775] = "The call was blocked by the remote computer"
  164. $arr[776] = "The call could not be connected because the destination has invoked the Do Not Disturb feature"
  165. $arr[777] = "The connection attempt failed because the modem on the remote computer is out of order"
  166. $arr[778] = "It was not possible to verify the identity of the server"
  167. $arr[779] = "To dial out using this connection, you must use a smart card"
  168. $arr[780] = "An attempted function is not valid for this connection"
  169. $arr[781] = "The encryption attempt failed because no valid certificate was found"
  170.  
  171. SplashTextOn("Autonetwork",@CRLF & @CRLF & "Please wait while I change your wireless network",800,200,-1,-1,0,"",24,500)
  172. run("C:\Program Files\NETGEAR\WG511SCU\Utility\Gear511.exe")
  173. WinWaitActive("NETGEAR WG511T SMART WIZARD - Wireless Assistant")
  174. $cur = ControlGetText("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5")
  175. if ($cur == "Home") then
  176. $new = "Office"
  177. else
  178. $new = "Home"
  179. endif
  180. ControlFocus("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5")
  181. $Ref = ControlCommand("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5","FindString",$new)
  182. ControlCommand("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","ComboBox5","SetCurrentSelection",$Ref)
  183. ControlFocus("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","Button2")
  184. ControlClick("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","Button2")
  185. ControlClick("NETGEAR WG511T SMART WIZARD - Wireless Assistant","","Button4")
  186. Sleep(5000)
  187. $Count = 0
  188. While (@IPAddress1 == '127.0.0.1')
  189. Sleep(100)
  190. $Count = $Count + 1;
  191. if ($Count == 30) then
  192.   ExitLoop
  193. endif
  194. WEnd
  195. if (not(@IPAddress1 == '127.0.0.1')) then
  196. if ($new == "Home") then
  197.   sleep(2000)
  198.   $ret = RunWait( @ComSpec & " /C ""rasdial " & $DSL & " " & $Username & " " & $Password & """", "", @SW_HIDE )
  199.   if ($ret > 0) then
  200.   SplashOff()
  201.   msgbox(48,"Connection to " & $DSL & " Failed",$arr[$ret])
  202.   endif
  203. endif
  204. endif
  205. SplashOff()
  206. if (@IPAddress1 == '127.0.0.1') then
  207. msgbox(0,"Autonetwork","It seems that the switch to the " & $new & " network has failed")
  208. endif
  209. Download this code: networkswitch.au3 (Downloaded 203 time(s))
Comments

Spam no more - rel=nofollow is active here, spamming my comments will not help your page rank.

  Textile help
---== Copyright Shannon Wynter - All rights reserved - All wrongs avenged ==---