#RequireAdminwindows
#include <GUIConstantsEx.au3>服務器
Opt("GUICloseOnESC", 0)網絡
Opt("TrayAutoPause", 0)ide
Opt("TrayMenuMode", 1)工具
#Region ### START Koda GUI section ### Form=ui
GUICreate("IP切換器",500, 260)spa
GUISetBkColor(0x00E0FFFF)orm
GUISetFont(9, 300)router
$tab = GUICtrlCreateTab(5, 10, 490, 240)dns
;辦公網絡
$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