#RequireAdmin

#include <GUIConstantsEx.au3>

Opt("GUICloseOnESC", 0)

Opt("TrayAutoPause", 0)

Opt("TrayMenuMode", 1)


#Region ### START Koda GUI section ### Form=

GUICreate("IP切换器",500, 260)

GUISetBkColor(0x00E0FFFF)

GUISetFont(9, 300)


$tab = GUICtrlCreateTab(5, 10, 490, 240)

;办公网络

$BanGong = GUICtrlCreateTabItem("办公")

$BG = GUICtrlCreateButton("办公网络", 20, 50, 75, 40)

;一层教室名称

$yiceng = GUICtrlCreateTabItem("一层")

$js101 = GUICtrlCreateButton("101教室", 20, 50, 75, 40)

$js102 = GUICtrlCreateButton("102教室", 110, 50, 75, 40)

$js103 = GUICtrlCreateButton("103教室", 200, 50, 75, 40)

$js104 = GUICtrlCreateButton("104教室", 290, 50, 75, 40)

$js105 = GUICtrlCreateButton("105教室", 380, 50, 75, 40)


;二层教室名称

$erceng = GUICtrlCreateTabItem("二层")

$js201 = GUICtrlCreateButton("201教室", 20, 50, 75, 40)

$js202 = GUICtrlCreateButton("202教室", 110, 50, 75, 40)

$js203 = GUICtrlCreateButton("203教室", 200, 50, 75, 40)

$js204 = GUICtrlCreateButton("204教室", 290, 50, 75, 40)

$js205 = GUICtrlCreateButton("205教室", 380, 50, 75, 40)


$MenuItem1 = TrayCreateItem("关于")

TrayCreateItem("")

$MenuItem2 = TrayCreateItem("退出工具")

GUISetState(@SW_SHOW)


GUISetState(@SW_SHOW)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$msg = TrayGetMsg() ;右击图标菜单事件

If $msg = $MenuItem2 Then

Exit

EndIf


If $msg = $MenuItem1 Then

MsgBox("", "关于", "火星时代")

EndIf

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

;办公网络

Case $BG

BanGong()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为办公IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以办公了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect


;一层教室

Case $js101

Class101()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为101教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js102

Class102()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为102教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js103

Class103()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为103教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js104

Class104()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为104教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js105

Class105()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为105教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

;二层教室

Case $js201

Class201()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为201教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js202

Class202()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为202教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js203

Class203()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为203教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js204

Class204()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为204教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

Case $js205

Class205()

$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为205教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)

Select

Case $tishi = 1 Or $tishi = -1

Exit

Case $tishi = 2

WinClose("成功")

EndSelect

EndSwitch

WEnd

;办公网络IP地址参数

Func BanGong()

RunWait('netsh interface ip set address name = "本地连接"  source = dhcp gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = dhcp register = PRIMARY', "c:\windows\system32", @SW_HIDE)

EndFunc   ;==>BanGong


;一层教室IP地址参数

Func Class101()

$IP = "10.1.11.10"

$zwym = "255.255.255.0"

$router = "10.1.11.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

EndFunc   ;==>Class101


Func Class102()

$IP = "10.1.12.10"

$zwym = "255.255.255.0"

$router = "10.1.12.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.12.2\",@DesktopDir & "\102教室服务器.lnk")

EndFunc   ;==>Class102


Func Class103()

$IP = "10.1.13.10"

$zwym = "255.255.255.0"

$router = "10.1.13.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.13.2\",@DesktopDir & "\103教室服务器.lnk")

EndFunc   ;==>Class103


Func Class104()

$IP = "10.1.14.10"

$zwym = "255.255.255.0"

$router = "10.1.14.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.14.2\",@DesktopDir & "\104教室服务器.lnk")

EndFunc   ;==>Class104


Func Class105()

$IP = "10.1.15.10"

$zwym = "255.255.255.0"

$router = "10.1.15.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.15.2\",@DesktopDir & "\105教室服务器.lnk")

EndFunc   ;==>Class105

;二层教室IP地址参数

Func Class201()

$IP = "10.1.32.10"

$zwym = "255.255.255.0"

$router = "10.1.32.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.32.2\",@DesktopDir & "\201教室服务器.lnk")

EndFunc   ;==>Class201


Func Class202()

$IP = "10.1.33.10"

$zwym = "255.255.255.0"

$router = "10.1.33.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.33.2\",@DesktopDir & "\202教室服务器.lnk")

EndFunc   ;==>Class202


Func Class203()

$IP = "10.1.34.10"

$zwym = "255.255.255.0"

$router = "10.1.34.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.34.2\",@DesktopDir & "\203教室服务器.lnk")

EndFunc   ;==>Class203


Func Class204()

$IP = "10.1.35.10"

$zwym = "255.255.255.0"

$router = "10.1.35.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.35.2\",@DesktopDir & "\204教室服务器.lnk")

EndFunc   ;==>Class204


Func Class205()

$IP = "10.1.36.10"

$zwym = "255.255.255.0"

$router = "10.1.36.254"

$dns = "10.2.1.91"

$bak_dns = "10.2.1.90"

RunWait('netsh interface ip set address name = "本地连接"  source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip set dns name = "本地连接"  source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)

RunWait('netsh interface ip add dns name = "本地连接"  addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)

FileDelete(@DesktopDir & "\*教室服务器.lnk")

FileCreateShortcut("\\10.1.36.2\",@DesktopDir & "\205教室服务器.lnk")

EndFunc   ;==>Class205