Jump to content
Sign in to follow this  
deployk

I have a question

Recommended Posts

deployk

How to create list with network connection for this script

CODE
#NoTrayIcon

#include <GUIConstants.au3>

$IP_address = True

$Subnet_mask = True

$Default_gateway = True

$Preferred_DNSserver = True

$Alternate_DNSserver = True

; LAN info

$netname = "Local Area Connection"

$frmInformation = GUICreate("User information", 330, 295, 320, 280)

$lblIP_address = GUICtrlCreateLabel("IP address:", 15, 44, 120, 17)

$lblSubnet_mask = GUICtrlCreateLabel("Subnet mask:", 15, 82, 120, 17)

$txtIP_address = GUICtrlCreateInput("", 160, 40, 153, 21)

$txtSubnet_mask = GUICtrlCreateInput("", 160, 80, 153, 21)

$lblDefault_gateway = GUICtrlCreateLabel("Default gateway:", 15, 124, 160, 17)

$txtDefault_gateway = GUICtrlCreateInput("", 160, 122, 154, 21)

$lblPreferred_DNSserver = GUICtrlCreateLabel("DNS1:", 15, 184, 126, 17)

$txtPreferred_DNSserver = GUICtrlCreateInput("", 160, 180, 153, 21)

$lblAlternate_DNSserver = GUICtrlCreateLabel("DNS2:", 15, 216, 155, 17)

$txtAlternate_DNSserver = GUICtrlCreateInput("", 160,212,153,21)

GUICtrlCreateGroup("IP Settings", 5, 25, 320, 130)

GUICtrlCreateGroup("DNS Settings", 5, 158, 320, 90)

GUICtrlCreateCombo("Select Network adapter", 10, 260, 220, 140)

$btnOK = GUICtrlCreateButton("&GO", 238, 258, 75, 20, 0)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $btnOK

$IP_address = GUICtrlRead($txtIP_address)

$Subnet_mask = GUICtrlRead($txtSubnet_mask)

$Default_gateway = GUICtrlRead($txtDefault_gateway)

$Preferred_DNSserver = GUICtrlRead($txtPreferred_DNSserver)

$Alternate_DNSserver = GUICtrlRead($txtAlternate_DNSserver)

ExitLoop

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

GUISetState(@SW_HIDE)

runwait ('netsh interface ip set address name=' & '"' & $netname & '" dhcp', "", @SW_HIDE)

runwait ('netsh interface ip set address name=' & '"' & $netname & '" static ' & $IP_address & ' '& $Subnet_mask & ' ' & $Default_gateway & ' 1',"",@SW_Hide)

runwait ('netsh interface ip set dns name=' & '"' & $netname & '" source=static ' & $Preferred_DNSserver & '',"")

runwait ('netsh interface ip add dns name=' & '"' & $netname & '" addr= ' & GUICtrlRead($txtAlternate_DNSserver) & '',"")

Share this post


Link to post
Share on other sites
herewasplato

I do not know - but here is a bump... maybe others can help.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×