#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>
#include <ACN_NET.au3>
$Form1 = GUICreate("Client脚本添加工具", 370, 356, 196, 133)
GUISetIcon("1.ICO", -1)
$Label1 = GUICtrlCreateLabel("服务器IP地址:", 24, 16, 122, 17)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 152, 16, 185, 25, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$Label2 = GUICtrlCreateLabel("域服务器IP地址:", 48, 56, 98, 17) ;能自动获取最好
$IPAddress2 = _GUICtrlIpAddress_Create($Form1, 152, 56, 185, 25, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
_GUICtrlIpAddress_Set($IPAddress2, "0.0.0.0")
$Label3 = GUICtrlCreateLabel("域服务器域名:", 56, 96, 88, 17);能自动获取最好
$Input1 = GUICtrlCreateInput("Input1", 152, 96, 185, 21, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$Label4 = GUICtrlCreateLabel("客户端MAC:", 64, 136, 75, 17)
$Input2 = GUICtrlCreateInput("Input2", 152, 136, 185, 21, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$Group1 = GUICtrlCreateGroup("登录方式", 24, 168, 321, 105)
$Radio1 = GUICtrlCreateRadio("非域自动登录", 48, 200, 97, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHT))
$Radio2 = GUICtrlCreateRadio("域自动登录", 208, 200, 81, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHT))
$Radio3 = GUICtrlCreateRadio("标准登录", 48, 232, 73, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHT))
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio4 = GUICtrlCreateRadio("非强制登录", 144, 232, 89, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHT))
$Radio5 = GUICtrlCreateRadio("强制登录", 248, 232, 81, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHT))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("运行", 16, 296, 89, 25)
$Button2 = GUICtrlCreateButton("退出", 256, 296, 89, 25)
$Button3 = GUICtrlCreateButton("配置文件", 136, 296, 89, 25);可以通过配置文件导入和导出,填写上面的内容和保存上述内容
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;用户代码
Dim $ADDN, $SType, $MAC, $WSSType
$SWWIP = _GUICtrlIpAddress_Get($IPAddress1)
$ADIP = _GUICtrlIpAddress_Get($IPAddress2)
$MAC = _API_Get_NetworkAdapterMAC(@IPAddress1);获取mac地址
GUICtrlSetData($Input2, $MAC) ;回值给Input2
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
Exit
Case $Button1
$ADDN = GUICtrlRead($Input1);获取input控件中输入的信息
;32位系统注册表键值
RegWrite("HKLM\SOFTWARE\test", "SrvIP", "REG_SZ", $SWWIP)
RegWrite("HKLM\SOFTWARE\test", "DomainSrvIP", "REG_SZ", $ADIP)
RegWrite("HKLM\SOFTWARE\test", "SrvPORT", "REG_SZ", "2222")
RegWrite("HKLM\SOFTWARE\test", "DomainName", "REG_SZ", $ADDN)
RegWrite("HKLM\SOFTWARE\test", "StartupType", "REG_DWORD", $SType)
RegWrite("HKLM\SOFTWARE\test", "ValidMac", "REG_SZ", $MAC)
RegWrite("HKLM\SOFTWARE\test", "WorkstationStartupType", "REG_DWORD", $WSSType)
;64位系统注册表键值
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "SrvIP", "REG_SZ", $SWWIP)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "DomainSrvIP", "REG_SZ", $ADIP)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "SrvPORT", "REG_SZ", "2222")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "DomainName", "REG_SZ", $ADDN)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "StartupType", "REG_DWORD", $SType)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "ValidMac", "REG_SZ", $MAC)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test", "WorkstationStartupType", "REG_DWORD", $WSSType)
;判断单选框状态
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_MULTI_SZ", "0")
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey1", "REG_MULTI_SZ", "0")
ElseIf GUICtrlRead($Radio2) = $GUI_CHECKED Then
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_MULTI_SZ", "1")
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey1", "REG_MULTI_SZ", "0")
ElseIf GUICtrlRead($Radio3) = $GUI_CHECKED Then
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey1", "REG_MULTI_SZ", "0")
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_MULTI_SZ", "0")
ElseIf GUICtrlRead($Radio4) = $GUI_CHECKED Then
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey1", "REG_MULTI_SZ", "2")
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_MULTI_SZ", "0")
ElseIf GUICtrlRead($Radio5) = $GUI_CHECKED Then
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey1", "REG_MULTI_SZ", "1")
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_MULTI_SZ", "0")
EndIf
MsgBox(0, "提示...", "添加成功...")
EndSwitch
WEnd