#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=ico.ico
#AutoIt3Wrapper_Res_Comment=
#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_LegalCopyright=
#AutoIt3Wrapper_Res_Fileversion=8.8.8.8
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Misc.au3>
HotKeySet("{ESC}", "Exitzd")
;=============== 每次只能运行一个程序 =================
if _Singleton("AutoICafe",1) = 0 Then ;如果带有这个标题的窗口已经存在, 则转到 OhNo 自定义函数模块
OhNo() ;转到自定义函数语句
EndIf ;结束以上的 If 判断
Func OhNo() ;自定义函数模块
MsgBox(64 + 262144,'老大Orz, 貌似本程序已经运行了!','貌似本程序已经运行了, 请结束任务后再运行...囧..!!',5) ;对话框提示, 延时 5 秒 (可以用气泡函数 TrayTip() 提示)
Exit ;退出
EndFunc ;自定义函数模块结束
;===================================================
Dim $Dll
$File = @ScriptDir&"\setup.ini"
FileInstall("setup.ini", @ScriptDir & "\setup.ini", 0)
$infcheck = FileExists(@ScriptDir & "\setup.ini");检查指定文件或目录是否存在
If $infcheck = 0 Then
MsgBox(48,"温馨提醒您:", "未找到程序配置文件,程序将自动创建."& @CRLF &"请将文件内的服务器路径修改成自己的实际路径.")
IniWrite($File, "服务器IP", "IP","192.168.0.250")
IniWrite($File, "客户端参数设置", "前段机器名","TYS")
IniWrite($File, "客户端参数设置", "前段IP","192.168.0")
IniWrite($File, "客户端参数设置", "子网","255.255.255.0")
IniWrite($File, "客户端参数设置", "网关","192.168.0.1")
IniWrite($File, "客户端参数设置", "DNS","202.100.192.68")
IniWrite($File, "客户端参数设置", "DNS2","202.100.199.8")
IniWrite($File, "客户端参数设置", "虚拟内存大小","1024")
IniWrite($File, "客户端参数设置", "是否安装网络驱动","1")
IniWrite($File, "客户端参数设置", "是否还原","0")
IniWrite($File, "客户端参数设置", "是否重启","0")
EndIf
Dim $a,$b,$c,$d,$e,$f,$g,$h,$j,$k,$i,$n,$o,$l ;定义变量
$a=IniRead("setup.ini","服务器IP","IP","") ;从setup.ini文件中读取输入并赋予给变量a,下面同理(同理的只解释1遍哦)
$b=IniRead("setup.ini","客户端路径","path","")
$c=IniRead("setup.ini","客户端参数设置","子网","")
$d=IniRead("setup.ini","客户端参数设置","网关","")
$e=IniRead("setup.ini","客户端参数设置","DNS","")
$f=IniRead("setup.ini","客户端参数设置","DNS2","")
$n=IniRead("setup.ini","客户端参数设置","是否安装网络驱动","")
$g=IniRead("setup.ini","客户端参数设置","是否还原","")
$h=IniRead("setup.ini","客户端参数设置","是否重启","")
$i=IniRead("setup.ini","客户端参数设置","前段机器名","")
$o=IniRead("setup.ini","客户端参数设置","前段IP","")
$l=IniRead("setup.ini","客户端参数设置","虚拟内存大小","")
$j=InputBox("网维自动部署程序","输入后段机器名","","",350,10)
$k=InputBox("网维自动部署程序","输入后段IP","","",350,10)
RegWrite ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "VirtualNetworkNumber", "REG_DWORD", $k)
RegWrite ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters","VirtualNetworkNumber", "REG_DWORD", $k)
const $Hkey1="HKLM\SYSTEM\CurrentControlSet\Enum\PCIIDE\IDEChannel"
const $Hkey2="HKLM\SYSTEM\CurrentControlSet\Control\Class"
$driver=0
for $x=1 to 20
$subkey1=RegEnumKey($Hkey1,$x)
if @error=-1 then ExitLoop
$subkey2=RegRead($Hkey1&""&$subkey1,"Driver")
$name=RegRead($Hkey2&""&$subkey2,"DriverDesc")
$master=RegRead($Hkey2&""&$subkey2,"MasterDeviceType")
if $master=0 Then
RegWrite($Hkey2&""&$subkey2,"UserMasterDeviceType","REG_DWORD","3")
ElseIf $master=1 Then
$driver=$driver+1
EndIf
$slave=RegRead($Hkey2&""&$subkey2,"SlaveDeviceType")
if $slave=0 Then
RegWrite($Hkey2&""&$subkey2,"UserSlaveDeviceType","REG_DWORD","3")
ElseIf $slave=1 Then
$driver=$driver+1
EndIf
Next
Run($b)
Sleep(8000)
If WinExists("网维大师(ICafe) 娱乐平台--安装","修改、修复或删除程序") Then
Sleep(1000)
WinWaitActive("网维大师(ICafe) 娱乐平台--安装","修改、修复或删除程序")
Send("!r")
Send("!n")
WinWaitActive("网维大师(ICafe) 娱乐平台--安装","是否要完全除去所选应用程序及其所有功能")
Send("!y")
WinWaitActive("网维大师(ICafe) 娱乐平台--安装","卸载完成")
Send("{down}")
Send("{enter}")
run($b)
EndIf
WinWaitActive("网维大师(ICafe) 娱乐平台--安装","Wizard 将在计算机中安装")
Send("!n")
WinWaitActive("网维大师提醒您","D盘数据会被清空")
Send("!y")
WinWaitActive("网维大师(ICafe) 娱乐平台--安装","顺网软件最终用户许可协议")
Send("!y")
WinWaitActive("网维大师(ICafe) 娱乐平台--安装","InstallShield Wizard 完成")
Send("{enter}")
WinWaitActive("客户端安装类型选择","系统管理的大小")
Send("!p")
ControlSetText("客户端安装类型选择","系统管理的大小","Edit1",$l)
ControlSetText("客户端安装类型选择","系统管理的大小","Edit2",$l)
ControlSetText("客户端安装类型选择","系统管理的大小","Edit3",$a);把变量A的值发送到文本输入框中,变量A是从INI文件中读取的
If $n=0 Then
Send("!a")
EndIf
Send("!n")
WinWaitActive("手动设置机器名与IP","客户机将在重启后处于还原保护状态")
ControlSetText("手动设置机器名与IP","客户机将在重启后处于还原保护状态","Edit1",$i&$j)
ControlSetText("手动设置机器名与IP","客户机将在重启后处于还原保护状态","Edit2",$o&"."&$k);用&来连接两个字符串
ControlSetText("手动设置机器名与IP","客户机将在重启后处于还原保护状态","Edit3",$c)
ControlSetText("手动设置机器名与IP","客户机将在重启后处于还原保护状态","Edit4",$d)
ControlSetText("手动设置机器名与IP","客户机将在重启后处于还原保护状态","Edit5",$e)
ControlSetText("手动设置机器名与IP","客户机将在重启后处于还原保护状态","Edit6",$f)
If $g=0 Then
Send("!r")
EndIf
Sleep(1000)
Send("!o")
WinWaitActive("提示","客户端安装完成,是否重启系统")
If $h=0 Then
Send("!n")
WinActive("手动设置机器名与IP","客户机将在重启后处于还原保护状态")
Send("!c")
Else
Send("!y")
Sleep(2000)
EndIf
Func Exitzd()
Exit
EndFunc