Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ----------------------------------------------------------------------------------
- ;
- ; AutoIt Version: 3.1.0
- ; Author: Wookie-Tramp
- ;
- ; Script Function: Flip Flop IP Address for Laptop Users
- ;
- ; Version 1.0 26/08/05
- ;
- ; Extra Info : see readme.doc for info.
- ;
- ; ----------------------------------------------------------------------------------
- #include <GUIConstants.au3>
- #NoTrayIcon
- ;*** EDITABLE VARIABLES ***
- $IP_ADDY="192.168.101.17"
- ;*** END EDIT VARIABLES ***
- Opt("GUIResizeMode", 1)
- Opt("GUIOnEventMode", 1)
- $locSelect = GUICreate("Location Selector", 200, 210)
- GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
- GUICtrlCreateLabel ("IP Address utility Laptop User", 30, 20, 180)
- GUICtrlCreateLabel ("ONLY PRESS BUTTON ONCE !", 25,80)
- GUICtrlSetColor(-1,0xff0000)
- $Location1 = GUICtrlCreateButton ("DHCP", 50, 100, 100)
- GUICtrlSetOnEvent(-1, "DHCP_IP")
- $Location2 = GUICtrlCreateButton ("Static IP", 50, 135, 100)
- GUICtrlSetOnEvent(-1, "STATIC_IP")
- $cancel1 = GUICtrlCreateButton ( "Exit", 50, 170, 100)
- GUICtrlSetOnEvent(-1, "Quit")
- GUICtrlSetState(-1, $GUI_FOCUS)
- GUISetState(@SW_SHOW)
- ; Just idle around
- While 1
- Sleep(10)
- Wend
- ; END
- Func DHCP_IP()
- $VAL=RunWait(@COMSPEC & " /c netsh interface ip set address name=" & "local area connection" & " source=dhcp", "c:\", @SW_MINIMIZE)
- $VAL1=RunWait(@COMSPEC & " /c netsh interface ip set dns name=" & "local area connection" & " source=dhcp", "c:\", @SW_MINIMIZE)
- IF $VAL=0 AND $VAL1=0 THEN
- MsgBox(64, "IP Address Config", "You are now setup for DHCP address allocation")
- ELSE
- MsgBox(48, "IP Address Config", "DHCP already enabled or other error please contact the service desk")
- EndIf
- EndFunc
- Func STATIC_IP()
- $VAL=RunWait(@COMSPEC & " /c netsh interface ip set address name=" & "local area connection" & " source=static addr=" & $IP_ADDY & " mask=255.255.255.0 gateway=192.168.101.1 gwmetric=1", "c:\", @SW_MINIMIZE)
- $VAL1=RunWait(@COMSPEC & " /c netsh interface ip set dns name=" & "local area connection" & " source=static addr=192.168.200.101", "c:\", @SW_MINIMIZE)
- IF $VAL=0 AND $VAL1=0 THEN
- MsgBox(64, "Static IP Address Config", "You are now setup with a static IP Address")
- ELSE
- MsgBox(48, "Static IP Address Config", "Unable to bind a static IP address please contact the service desk")
- EndIf
- EndFunc
- Func Quit()
- Exit
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment