Nathanrr

Changing to dynamic ip address

7 posts in this topic

#1 ·  Posted

Hello guys .. i am really new with autoit , i am trying to make scrip that changes the ip to an dynamic ip 

ShellExecute ("C:\Windows\System32\ncpa.cpl")
WinWaitActive("Network Connections")
Send("{home}{enter}")
WinWaitActive("Ethernet 2 Status")
Send("{tab}{enter}")
WinActivate("Ethernet 2 Properties")
send("{DOWN}{DOWN}{DOWN}")

but once i get to the ethernet properties its not clicking anything ..any advice ? 

ty

Share this post


Link to post
Share on other sites



#2 ·  Posted

Just use the Network UDF (see below), for example:

#RequireAdmin
#include "Network.au3"

_EnableDHCP("Ethernet")

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

11 minutes ago, Subz said:

Just use the Network UDF (see below), for example:

#RequireAdmin
#include "Network.au3"

_EnableDHCP("Ethernet")

ty its working great, but i still wonder why my script is not working :(

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

Because you require #RequireAdmin at the top of your script

Share this post


Link to post
Share on other sites

#5 ·  Posted

2 minutes ago, Subz said:

Because you require #RequireAdmin at the top of your script

still not working with admin , but if  i run the script twice without closing the windows he opens  in first time  it works ..

Share this post


Link to post
Share on other sites

#6 ·  Posted

Might be just my system then, basically each system is going to be different which is why send keys usually suck imho.  For example on my system I would have to use the following for it to work, maybe you just need to add WinWaitActive("Ethernet 2 Properties") like in the example below.

#RequireAdmin
ShellExecute ("C:\Windows\System32\ncpa.cpl")
WinWaitActive("Control Panel\All Control Panel Items\Network Connections")
Send("Ethernet{enter}")
WinWaitActive("Ethernet Status")
Send("{tab}{enter}")
WinActivate("Ethernet Properties")
WinWaitActive("Ethernet Properties")
send("{DOWN}{DOWN}{DOWN}")

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

6 minutes ago, Nathanrr said:

still not working with admin , but if  i run the script twice without closing the windows he opens  in first time  it works ..

 

6 minutes ago, Nathanrr said:

still not working with admin , but if  i run the script twice without closing the windows he opens  in first time  it works ..

Sorry my bad its works  .

ty everyone

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