Advertisement
Guest User

Change IPv4

a guest
Nov 11th, 2019
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.34 KB | None | 0 0
  1. #RequireAdmin
  2. #include <ButtonConstants.au3>
  3. #include <ComboConstants.au3>
  4. #include <GUIConstantsEx.au3>
  5. #include <StaticConstants.au3>
  6. #include <WindowsConstants.au3>
  7. #Region ### START Koda GUI section ### Form=
  8. $Form1 = GUICreate("Form1", 298, 61, 192, 124)
  9. $Label1 = GUICtrlCreateLabel("Adaptor :", 8, 8, 47, 17)
  10. $Combo1 = GUICtrlCreateCombo("Wi-Fi", 64, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
  11. $Button1 = GUICtrlCreateButton("Change", 216, 8, 75, 25)
  12. $Label2 = GUICtrlCreateLabel("Ipv4 Now:", 8, 40, 53, 17)
  13. $Label3 = GUICtrlCreateLabel("Label3", 64, 32, 228, 17)
  14. GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
  15. GUICtrlSetColor(-1, 0xFF0000)
  16. GUISetState(@SW_SHOW)
  17. #EndRegion ### END Koda GUI section ###
  18.  
  19. GUICtrlSetData($Label3, @IPAddress1)
  20.  
  21. While 1
  22.     $nMsg = GUIGetMsg()
  23.     Switch $nMsg
  24.         Case $GUI_EVENT_CLOSE
  25.             Exit
  26.         Case $Button1
  27.             GUICtrlSetData($Label3, 'Change.')
  28.             Run('netsh interface ipv4 set address name="' & GUICtrlRead($Combo1) & '" static 192.168.1.' & Random(5,255,1) & ' 255.255.255.0 192.168.1.1', @WorkingDir, @SW_HIDE)
  29.             Sleep(100)
  30.             While StringLeft(@IPAddress1,3) = "127"
  31.                 Sleep(100)
  32.                 GUICtrlSetData($Label3, GUICtrlRead($Label3) & '.')
  33.             WEnd
  34.             GUICtrlSetData($Label3, @IPAddress1)
  35.  
  36.     EndSwitch
  37. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement