这个是7130版本,自动下载安装,需要的朋友可以自行修改为最新版本!
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <GUIConstants.au3>
Opt("TrayIconHide", 1);
$au3name = "网维大师客户端自动安装器"
$file = "NBMSClient.exe"
$SectionNames = "配置信息"
$title = "顺网网维大师蝌蚪娱乐平台V7.1.3.0 - 安装"
$Dir = StringTrimRight("config.", 0) & "ini"
$objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For $objItem In $colItems
$LocalIP = $objItem.IPAddress(0)
$LocalSubnetmask = $objItem.IPSubnet(0)
$LocalGateway = $objItem.DefaultIPGateway(0)
$LocalDns1 = $objItem.DNSServerSearchOrder(0)
$LocalDns2 = $objItem.DNSServerSearchOrder(1)
$Lanname = $objItem.Caption(0)
$MACAddress = $objItem.MACAddress(0)
$IPXVirtualNetNumber = $objItem.IPXVirtualNetNumber(0) 1. Next 2. $pcName = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName") 3. $ServIP = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\iCafe8", "ServIP") 4. $BarServAddr = IniRead($Dir, $SectionNames, "网维服务器IP", "") 5. If $BarServAddr = "" Then IniWrite($Dir, $SectionNames, "网维服务器IP", $ServIP) 6. $BarServAddr = IniRead($Dir, $SectionNames, "网维服务器IP", "") 7. $ComputerName = IniRead($Dir, $SectionNames, "计算机名称", "") 8. If $ComputerName = "" Then IniWrite($Dir, $SectionNames, "计算机名称", $pcName) 9. $ComputerName = IniRead($Dir, $SectionNames, "计算机名称", "") 10. $IPAddress = IniRead($Dir, $SectionNames, "IP地址", "") 11. If $IPAddress = "" Then IniWrite($Dir, $SectionNames, "IP地址", $LocalIP) 12. $IPAddress = IniRead($Dir, $SectionNames, "IP地址", "") 13. $Subnetmask = IniRead($Dir, $SectionNames, "子网掩码", "") 14. If $Subnetmask = "" Then IniWrite($Dir, $SectionNames, "子网掩码", $LocalSubnetmask) 15. $Subnetmask = IniRead($Dir, $SectionNames, "子网掩码", "") 16. $Gateway = IniRead($Dir, $SectionNames, "网关地址", "") 17. If $Gateway = "" Then IniWrite($Dir, $SectionNames, "网关地址", $LocalGateway) 18. $Gateway = IniRead($Dir, $SectionNames, "网关地址", "") 19. $Dns1 = IniRead($Dir, $SectionNames, "首选DNS", "") 20. If $Dns1 = "" Then IniWrite($Dir, $SectionNames, "首选DNS", $LocalDns1) 21. $Dns1 = IniRead($Dir, $SectionNames, "首选DNS", "") 22. $Dns2 = IniRead($Dir, $SectionNames, "备用DNS", "") 23. If $Dns2 = "" Then IniWrite($Dir, $SectionNames, "备用DNS", $LocalDns2) 24. $Dns2 = IniRead($Dir, $SectionNames, "备用DNS", "") 25. $nosafe = IniRead($Dir, $SectionNames, "设置还原", "") 26. If $nosafe = "" Then IniWrite($Dir, $SectionNames, "设置还原", "0") 27. $nosafe = IniRead($Dir, $SectionNames, "设置还原", "") 28. $Reboot = IniRead($Dir, $SectionNames, "设置重启", "") 29. If $Reboot = "" Then IniWrite($Dir, $SectionNames, "设置重启", "0") 30. $Reboot = IniRead($Dir, $SectionNames, "设置重启", "") 31. $delfile = IniRead($Dir, $SectionNames, "删除文件", "") 32. If $delfile = "" Then IniWrite($Dir, $SectionNames, "删除文件", "1") 33. $delfile = IniRead($Dir, $SectionNames, "删除文件", "") 34. $Interface = IniRead($Dir, $SectionNames, "外部接口", "") 35. If $Interface = "" Then IniWrite($Dir, $SectionNames, "外部接口", "") 36. $Interface = IniRead($Dir, $SectionNames, "外部接口", "") 37. $winrar = IniRead($Dir, $SectionNames, "WINRAR", "") 38. If $winrar = "" Then IniWrite($Dir, $SectionNames, "WINRAR", "C:\Program Files\WinRAR\Rar.exe") 39. $winrar = IniRead($Dir, $SectionNames, "WINRAR", "") 40. $down = IniRead($Dir, $SectionNames, "下载地址", "") 41. If $down = "" Then IniWrite($Dir, $SectionNames, "下载地址", "http://www.icafe8.com/icafe/archive/Icafe_Client7.1.3.0.exe") 42. $down = IniRead($Dir, $SectionNames, "下载地址", "") 43. $filename = IniRead($Dir, $SectionNames, "保存文件名", "") 44. If $filename = "" Then IniWrite($Dir, $SectionNames, "保存文件名", "Icafe_Client7.1.3.0.exe") 45. $filename = IniRead($Dir, $SectionNames, "保存文件名", "") 46. $IPXs = StringSplit($IPAddress, ".") 47. $IPX = $IPXs[4] 48. If StringLen($IPX) = 1 Then $IPX = "00" & $IPX 49. If StringLen($IPX) = 2 Then $IPX = "0" & $IPX 50. $IPX = "00000" & $IPX 51. $IPX = Dec($IPX) 52. If FileExists($file) = 0 And FileExists($filename) = 0 And FileExists($winrar) = 1 Then 53. InetGet($down, $filename, 1, 1) 54. While @InetGetActive 55. ToolTip("正在下载网维大师客户端,已下载 = " & @InetGetBytesRead, 400, 30, "提示", 0, 1) 56. Sleep(250) 57. WEnd 58. Sleep(1000) 59. EndIf 60. If FileExists($filename) = 1 And FileExists($winrar) = 1 And FileExists($file) = 0 Then 61. ToolTip("正在解压网维大师客户端,请稍等!!!", 400, 30, "提示", 0, 1) 62. RunWait(@ComSpec & " /c " & '"' & $winrar & '"' & " e -y " & $filename, "", @SW_HIDE) 63. FileDelete("readme(Client).txt") 64. FileDelete("顺网客户端安装包.exe") 65. Sleep(1000) 66. EndIf 67. If Not FileExists($file) Then 68. If FileExists($filename) = 1 Then FileDelete($filename) 69. MsgBox(1, "提示", "当前目录没有找到客户端安装文件 " & $file, 3) 70. Exit 71. EndIf 72. If ProcessExists("BarClientView.exe") Then 73. ProcessClose("BarClientView.exe") 74. If ProcessExists("HardwareInfo.exe") Then ProcessClose("HardwareInfo.exe") 75. If ProcessExists("ProcessSafe.exe") Then ProcessClose("ProcessSafe.exe") 76. _RefreshSystemTray() 77. EndIf 78. If ProcessExists("BarClientView.exe") Then 79. MsgBox(16, "错误", "无法关闭网维大师客户端进程,安装已中止!", 3) 80. Exit 81. EndIf 82. Run($file) 83. If WinWaitActive($title, "除去所有已安装功能", 2) = 1 Then 84. ToolTip("正在卸载旧版的网维大师客户端,请稍等!!!", 400, 30, "提示", 0, 1) 85. WinActive($title, "除去所有已安装功能") 86. ControlCommand($title, "除去所有已安装功能", "Button2", "Check", "") 87. ControlClick($title, "修改、修复或删除程序", "Button3") 88. WinWaitActive($title, "是否要完全除去所选应用程序及其所有功能") 89. ControlClick($title, "是否要完全除去所选应用程序及其所有功能", "Button1") 90. WinWaitActive($title, "卸载完成") 91. ControlCommand($title, "卸载完成", "Button2", "Check", "") 92. ControlClick($title, "卸载完成", "Button4") 93. $Form1 = GUICreate($au3name, 360, 140, Default, Default, $WS_DISABLED) 94. GUICtrlCreateLabel("正在重新启动安装程序,请稍等...", 50, 15, 273, 25) 95. GUICtrlSetColor(-1, 0xff0000) 96. $Progress1 = GUICtrlCreateProgress(40, 40, 273, 25, $PBS_MARQUEE) 97. GUICtrlSetColor(-1, 0x00ff00) 98. GUISetState(@SW_SHOW) 99. _SendMessage(GUICtrlGetHandle($Progress1), $PBM_SETMARQUEE, True, 150) 100. While 1 101. $msg = GUIGetMsg() 102. Select 103. Case ProcessExists($file) = 0 104. ExitLoop 105. EndSelect 106. WEnd 107. Sleep(1000) 108. Run($file) 109. icafe8() 110. Exit 111. EndIf 112. icafe8() 113. Func icafe8() 114. ToolTip("正在安装网维大师客户端,请稍等!!!", 400, 30, "提示", 0, 1) 115. WinWaitActive($title, "欢迎使用 网维大师蝌蚪娱乐平台 安装向导") 116. ControlClick($title, "欢迎使用 网维大师蝌蚪娱乐平台 安装向导", "Button1") 117. WinWaitActive($title, "选择最适合您的需求的安装类型") 118. ControlClick($title, "选择最适合您的需求的安装类型", "Button1") 119. WinWaitActive($title, "请选择娱乐平台安装环境") 120. ControlClick($title, "请选择娱乐平台安装环境", "Button7") 121. WinWaitActive("网维大师提醒您", "警告:安装本软件后,D盘数据会被清空!") 122. ControlClick("网维大师提醒您", "警告:安装本软件后,D盘数据会被清空!", "Button1") 123. WinWaitActive($title, "顺网软件最终用户许可协议") 124. ControlClick($title, "顺网软件最终用户许可协议", "Button1") 125. WinWaitActive($title, "安装向导 已成功安装") 126. ControlClick($title, "安装向导 已成功安装", "Button4") 127. WinWaitActive("客户端安装类型选择", "服务器地址或名称") 128. ControlSetText("客户端安装类型选择", "服务器地址或名称", "Edit3", $BarServAddr) 129. ControlClick("客户端安装类型选择", "提示", "Button8") 130. If FileExists("C:\Documents and Settings\All Users\桌面\游戏菜单.lnk") = 1 Then FileDelete("C:\Documents and Settings\All Users\桌面\游戏菜单.lnk") 131. RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $ComputerName) 132. RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $ComputerName) 133. RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", $ComputerName) 134. RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName", "REG_SZ", $ComputerName) 135. ToolTip("正在设置IP地址" & @CRLF & "机器名称:" & $ComputerName & @CRLF & "I P 地址:" & $IPAddress & @CRLF & "子网掩码:" & $Subnetmask & @CRLF & "网关地址:" & $Gateway & @CRLF & "首选DNS:" & $Dns1 & @CRLF & "备用DNS:" & $Dns2 & @CRLF & "服务器地址:" & $BarServAddr, 400, 30, "提示", 0, 1) 136. Sleep(3000) 137. WinWaitActive("手动设置机器名与IP", "客户机将在重启后处于还原保护状态") 138. ControlSetText("手动设置机器名与IP", "机器名称", "Edit1", $ComputerName) 139. ControlSetText("手动设置机器名与IP", "IP地址", "Edit2", $IPAddress) 140. ControlSetText("手动设置机器名与IP", "子网掩码", "Edit3", $Subnetmask) 141. ControlSetText("手动设置机器名与IP", "网关地址", "Edit4", $Gateway) 142. ControlSetText("手动设置机器名与IP", "首选DNS", "Edit5", $Dns1) 143. ControlSetText("手动设置机器名与IP", "备用DNS", "Edit6", $Dns2) 144. ControlSetText("手动设置机器名与IP", "服务器地址或名称", "Edit7", $BarServAddr) 145. If $nosafe = 1 Then ControlCommand("手动设置机器名与IP", "设置还原", "Button1", "UnCheck", "") 146. If $delfile = 1 Then 147. ToolTip("正在删除安装文件,请稍等!!!", 400, 30, "提示", 0, 1) 148. While 1 149. Select 150. Case ProcessExists($file) = 0 151. ExitLoop 152. EndSelect 153. WEnd 154. Sleep(1000) 155. If FileExists($filename) = 1 Then FileDelete($filename) 156. If FileExists($file) = 1 Then FileDelete($file) 157. EndIf 158. ControlClick("手动设置机器名与IP", "客户机将在重启后处于还原保护状态", "Button2") 159. $colItems = "" 160. $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") 161. Dim $SetIPAddress[1] 162. $SetIPAddress[0] = IniRead($Dir, $SectionNames, "IP地址", "") 163. Dim $SetSubnetmask[1] 164. $SetSubnetmask[0] = IniRead($Dir, $SectionNames, "子网掩码", "") 165. Dim $SetGateway[1] 166. $SetGateway[0] = IniRead($Dir, $SectionNames, "网关地址", "") 167. Dim $SetDns[2] 168. $SetDns[0] = IniRead($Dir, $SectionNames, "首选DNS", "") 169. $SetDns[1] = IniRead($Dir, $SectionNames, "备用DNS", "") 170. TrayTip("", "正在设置IP,请稍等...", 1) 171. $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20) 172. $colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem") 173. If IsObj($colItems) Then 174. For $objNetAdapter In $colItems 175. $objNetAdapter.EnableStatic($SetIPAddress, $SetSubnetmask) 176. $objNetAdapter.SetGateways($SetGateway) 177. $objNetAdapter.SetDNSServerSearchOrder($SetDns) 178. Next 179. EndIf 180. RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "VirtualNetworkNumber", "REG_DWORD", $IPX) 181. RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Nwlnkipx\Parameters", "VirtualNetworkNumber", "REG_DWORD", $IPX) 182. If $delfile = 1 Then FileDelete($Dir) 183. WinWaitActive("提示", "客户端安装完成,是否重启系统!") 184. If $Reboot = 0 Then 185. ControlClick("提示", "客户端安装完成,是否重启系统!", "Button2") 186. Else 187. ControlClick("提示", "客户端安装完成,是否重启系统!", "Button1") 188. EndIf 189. Exit 190. EndFunc ;==>icafe8 191. Func _RefreshSystemTray($nDelay = 1000) ;刷新任务栏图标 192. Local $oldMatchMode = Opt("WinTitleMatchMode", 4) 193. Local $oldChildMode = Opt("WinSearchChildren", 1) 194. Local $error = 0 195. Do 196. Local $hWnd = WinGetHandle("classname=TrayNotifyWnd") 197. If @error Then 198. $error = 1 199. ExitLoop 200. EndIf 201. Local $hControl = ControlGetHandle($hWnd, "", "Button1") 202. If $hControl "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then 203. ControlClick($hWnd, "", $hControl) 204. Sleep($nDelay) 205. EndIf 206. Local $posStart = MouseGetPos() 207. Local $posWin = WinGetPos($hWnd) 208. Local $y = $posWin[1] 209. While $y < $posWin[3] + $posWin[1] 210. Local $x = $posWin[0] 211. While $x < $posWin[2] + $posWin[0] 212. DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y) 213. If @error Then 214. $error = 2 215. ExitLoop 3; 216. EndIf 217. $x += 8 218. WEnd 219. $y += 8 220. WEnd 221. DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1]) 222. If $hControl "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then 223. ControlClick($hWnd, "", $hControl) 224. EndIf 225. Until 1 226. Opt("WinTitleMatchMode", $oldMatchMode) 227. Opt("WinSearchChildren", $oldChildMode) 228. SetError($error) 229. EndFunc ;==>_RefreshSystemTray
|