cramaboule Posted July 30, 2007 Share Posted July 30, 2007 (edited) Hello,I set this GUI to set my IP address much more easly.expandcollapse popup[/b] #include <GuiIPAddress.au3> #include <GuiConstants.au3> Global $i $GUI_SET=GuiCreate("Set IP address", 500, 270,-1, -1 ) ; --- Group ----- $Group1 = GuiCtrlCreateGroup("LAN", 10, 10, 230, 190) $Group2 = GuiCtrlCreateGroup("Wi-Fi", 260, 10, 230, 190) ; --- Labals ---- $Label_3 = GuiCtrlCreateLabel("Now is :", 20, 40, 40, 20) $Label_19 = GuiCtrlCreateLabel("Now is :", 270, 40, 60, 20) $Label_13 = GuiCtrlCreateLabel("IP", 20, 100, 60, 20) $Label_14 = GuiCtrlCreateLabel("Subnet", 20, 130, 60, 20) $Label_15 = GuiCtrlCreateLabel("Gateway", 20, 160, 60, 20) $Label_23 = GuiCtrlCreateLabel("IP", 270, 100, 60, 20) $Label_24 = GuiCtrlCreateLabel("Subnet", 270, 130, 70, 20) $Label_25 = GuiCtrlCreateLabel("Gateway", 270, 160, 60, 20) ; --- Radios ---- $DhcpLan = GuiCtrlCreateRadio("DHCP", 130, 70, 70, 20) $SetLan = GuiCtrlCreateRadio("Set manually", 20, 70, 80, 20) $DhcpWan = GuiCtrlCreateRadio("DHCP", 380, 70, 70, 20) $SetWan = GuiCtrlCreateRadio("Set manually", 270, 70, 80, 20) ; --- Actual IP ---- $IpLanIs = _GUICtrlIpAddressCreate ($GUI_SET, 70, 40, 140, 20) _GUICtrlIpAddressSet ($IpLanIs, @IPAddress1) $IpWanIs = _GUICtrlIpAddressCreate ($GUI_SET, 320, 40, 140, 20) _GUICtrlIpAddressSet ($IpWanIs, @IPAddress2) ; --- Settings IP ---- $IpLanSet = _GUICtrlIpAddressCreate ($GUI_SET, 70, 100, 140, 20) $SubLan = _GUICtrlIpAddressCreate ($GUI_SET, 70, 130, 140, 20) $GatLan = _GUICtrlIpAddressCreate ($GUI_SET, 70, 160, 140, 20) ; $IpWanSet = _GUICtrlIpAddressCreate ($GUI_SET, 320, 100, 140, 20) $SubWan = _GUICtrlIpAddressCreate ($GUI_SET, 320, 130, 140, 20) $GatWan = _GUICtrlIpAddressCreate ($GUI_SET, 320, 160, 140, 20) ; ; --- buttons ---- ; $Set_IP = GuiCtrlCreateButton("Set IP", 200, 220, 100, 30) $Refresh = GuiCtrlCreateButton("Refresh", 50, 220, 100, 30) $Exit = GuiCtrlCreateButton("Exit", 350, 220, 100, 30) ; GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Exit Or _IsPressed("1B") ExitLoop Case $msg = $Refresh _Refresh() Case GUICtrlRead ($SetLan) = 1 And $Set_IP = $msg $IpLanSeti = _GUICtrlIpAddressGet ( $IpLanSet ) $SubLani = _GUICtrlIpAddressGet ( $SubLan ) $GatLani = _GUICtrlIpAddressGet ( $GatLan ) RunWait(@ComSpec & " /c netsh interface ip set address "&chr(34)& _Lanlang(1) &chr(34)&" static "& $IpLanSeti &" "& $SubLani &" "& $GatLani & " 0", "", @SW_HIDE) MsgBox (32, "Done", "Your LAN is now Set !") _Refresh() Case GUICtrlRead ($DhcpLan) = 1 And $Set_IP = $msg RunWait(@ComSpec & " /c netsh interface ip set address "&chr(34)& _Lanlang(1) &chr(34)&" dhcp", "", @SW_HIDE) MsgBox (32, "Done", "Your LAN is now in DHCP !") _Refresh() Case GUICtrlRead ($SetWan) = 1 And $Set_IP = $msg $IpWanSeti = _GUICtrlIpAddressGet ( $IpWanSet ) $SubWani = _GUICtrlIpAddressGet ( $SubWan ) $GatWani = _GUICtrlIpAddressGet ( $GatWan ) RunWait(@ComSpec & " /c netsh interface ip set address "&chr(34)& _Lanlang(0) &chr(34)&" static "& $IpWanSeti &" "& $SubWani &" "& $GatWani & " 0", "", @SW_HIDE) MsgBox (32, "Done", "Your Wi-Fi is now Set !") _Refresh() Case GUICtrlRead ($DhcpWan) = 1 And $Set_IP = $msg RunWait(@ComSpec & " /c netsh interface ip set address "&chr(34)& _Lanlang(0) &chr(34)&" dhcp", "", @SW_HIDE) MsgBox (32, "Done", "Your Wi-Fi is now in DHCP !") _Refresh() Case Not( _GUICtrlIpAddressIsBlank ( $IpWanSet ) ) If GUICtrlRead($SetWan,$GUI_UNCHECKED) And $i=0 Then $i = 1 GUICtrlSetState ($SetWan,$GUI_CHECKED) EndIf _GUICtrlIpAddressSet ($SubWan, "255.255.255.0") _GUICtrlIpAddressSet ($GatWan, (_GUICtrlIpAddressGet ( $IpWanSet ))) Case Not( _GUICtrlIpAddressIsBlank ( $IpLanSet ) ) If GUICtrlRead($SetLan,$GUI_UNCHECKED) And $i=0 Then $i = 1 GUICtrlSetState ($SetLan,$GUI_CHECKED) EndIf _GUICtrlIpAddressSet ($SubLan, "255.255.255.0") _GUICtrlIpAddressSet ($GatLan, (_GUICtrlIpAddressGet ( $IpLanSet ))) Case Else ;;; EndSelect WEnd Exit Func _Refresh() $i = 0 GUICtrlSetState ($DhcpLan,$GUI_UNCHECKED) GUICtrlSetState ($SetLan,$GUI_UNCHECKED) GUICtrlSetState ($DhcpWan,$GUI_UNCHECKED) GUICtrlSetState ($SetWan,$GUI_UNCHECKED) _GUICtrlIpAddressSet ($IpLanIs, @IPAddress1) _GUICtrlIpAddressSet ($IpWanIs, @IPAddress2) _GUICtrlIpAddressClear ($IpLanSet) _GUICtrlIpAddressClear ($SubLan) _GUICtrlIpAddressClear ($GatLan) _GUICtrlIpAddressClear ($IpWanSet) _GUICtrlIpAddressClear ($SubWan) _GUICtrlIpAddressClear ($GatWan) EndFunc ;MsgBox(0, "Your OS Language:", _Lanlang()) Func _Lanlang($LAN) Select Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009,2409,2809,2c09,3009,3409", @OSLang);english If $LAN = 0 Then Return "Wireless Network Connection" Else Return "Local Area Connection" EndIf Case StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang); frensh If $LAN = 0 Then Return "Connexion réseau sans fil" Else Return "Connexion au réseau local" EndIf Case Else Return "Other (can't determine with @OSLang directly)" EndSelect EndFunc[b]oÝ÷ ÛöÈ*.$êÞm«¢+Ùl½t( Í9½Ð }U% Ñɱ%ÁÉÍÍ%Í ±¹¬ ÀÌØí%Á]¹MФ¤(%U% ÑɱI ÀÌØíMÑ]¸°ÀÌØíU%}U9 ! -¤¹ÀÌØí¤ôÀQ¡¸(ÀÌØí¤ôÄ(U% ÑɱMÑMÑÑ ÀÌØíMÑ]¸°ÀÌØíU%} ! -¤(¹%(}U% Ñɱ%ÁÉÍÍMÐ ÀÌØíMÕ]¸°ÅÕ½ÐìÈÔÔ¸ÈÔÔ¸ÈÔÔ¸ÀÅÕ½Ðì¤(}U% Ñɱ%ÁÉÍÍMÐ ÀÌØíÑ]¸°¡}U% Ñɱ%ÁÉÍÍÐ ÀÌØí%Á]¹MФ¤¤)mtMy gateway gets his address from the Ip address but after I entered the IP, I would like to change the gateway address...So, how can I do that ?I try to figure this out but, I can't !Thanks in advance for your help.[edit]Sorry it may be in the wrong furom !!! Edited July 30, 2007 by cramaboule My Autoit programs: MAC Address - - Delete Temp Files - - Ping Test - - Play Video with VLC full screen dual monitors - - Set IP - - Pics Converter - - AutoUpdater - - CPU Usage - - Ending Script Nicely - - GDI+ GUI crossfades (slide transitions) - - Beamer - - Search and Search in Files - - Silent Ninite Others: Export Icons into Dll - - My website Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now