Jump to content

IP Address Tool


Recommended Posts

This is a utility I've been working on to also help me learn AutoIT. It shows the network adapters and allows you to renew, release, set as static or dynamic.

You have to pick an adapter from the combo box for the Static or Dynamic buttons to do anything.

Comments, suggestions, improvements?

Bruce

Edited -don't d'load this version --scroll down in this thread for version2(nettest2d.au3) - fixed a couple of subscript errors.

nettest2c.au3

Edited by bshellenbaum
Link to comment
Share on other sites

Very nice tool beshellenbaum. One slight bug... ( I think )..

In the Display function

GUICTRLSetData ($subnet , $adapter[$result][5] )
    GUICTRLSetData ($gateway , $adapter[$result][6] )

If using a "static ip".. the display is correct. However if using "dhcp" the display is off in the fact that it shows the subnet as the current ip address and the gateway as the subnet. If I change the 5 to a 6 then the subnet is displayed correctly. But I can't seem to get the gateway to display correctly. Changing it's value ([$result][x] does not seem to display the correct gateway ip. See attached images.

Still going over the code..

Thanks for this very useful tool.

RocTx

Edited by RocTx
Link to comment
Share on other sites

That's one of the concerns I have. My system has 3 'adapters' but 2 of them are related to VMWare.

Can you do a ipconfig /all >ipinfo.txt and post the results here so I can see the values and then check against them.

I was trying to stay away from testing each line for IP, or subnet, or gateway or dhcp etc.... but it might be necessary.

Link to comment
Share on other sites

Fixed in this version

problem was in the loadup function, a couple of array subscripts were wrong

$adapter[$count][4] = stringstripcr(stringmid($temp[$n+4], 45)) ; adapter IP

$adapter[$count][7] = stringstripcr(stringmid($temp[$n+7], 45)) ; DHCP Server

$adapter[$count][5] = stringstripcr(stringmid($temp[$n+5], 45)) ;subnet mask

$adapter[$count][6] = stringstripcr(stringmid($temp[$n+6], 45)) ;gateway

$adapter[$count][8] = stringstripcr(stringmid($temp[$n+8], 45)) ; DNS Server

nettest2d.au3

Link to comment
Share on other sites

Excellent!!! The tool works perfectly! I have an IBM laptop connected with the onboard wired nic and also wifi. It detects both devices and I can select which adapter to view and all the correct information is there for them.

I was working on a similar script to do the same.. except it was taking me longer.

You beat me to it. But yours is great!! And I like it!

Again.. thanks for sharing..

Food for thought and maybe new feature..

Adding the Name of the DHCP, Gateway and DNS servers for those who are curious.

RocTx

Link to comment
Share on other sites

Tested on two systems - script not found any adapters. This is because my windows is localized. So someone may require change "Host Name" and "Desctiption" keywords into corresponding values.

<{POST_SNAPBACK}>

As I am mono-lingual, that never occurred to me. It should be easy to either:

1-change the search terms to whatever language is used or

2-make the search terms into variables, which can be easily found and changed at the beginning of the script.

I think offering a wide choice of built in langugae support defeats the small and lean nature of this type of thing.

Bruce

Link to comment
Share on other sites

As I am mono-lingual, that never occurred to me. It should be easy to either:

1-change the search terms to whatever language is used or

2-make the search terms into variables, which can be easily found and changed at the beginning of the script.

I think offering a wide choice of built in langugae support defeats the small and lean nature of this type of thing.

Bruce

<{POST_SNAPBACK}>

Of course, I've done it, just aware for others... no suggestion to add other languages! For adapting simplicity one can to place two variables at start of script with both keywords.

Nice tool anyway!

Link to comment
Share on other sites

Yes, nice work. Requires several tweaks to work correctly under Win2000, but the concept is sound. The only code I'm going to post is this:

$adapterlist = GuiCtrlCreateCombo ( "Adapter", 20, 180, 360, 30*($adaptercount + 1))

Corrects for a variance in the behaviour of GUICtrlCreateCombo on different platforms, as discussed recently in another thread. I also made it a little wider because it was truncating one of my adapter types.

Just FYI, the string offset in 2000 is 37 rather than 45 and several of the line numbers change.

601DisengageEnd Program

Link to comment
Share on other sites

  • 1 month later...

Yeah... but I try to avoid macros... I know it always makes me (and prolly him) feel smart if i can do somthing in an unconventional or quirky way. Maybe pointless but whatever

I was about 5 minutes away from coding this very program. I was searching thru the gui section so i could see how to use the gui feature (never did a gui before) and I came across the script i was about to write.

What Im thinking I may do is to incorperate this script, a script i recently made that detects the basic settings of your computer, and a logging feature into one prog. I work in IT and having a disk that will have a gui based ipconfig and will tell me about the computer would be nice.

I also invison making it make an entry in a log for every computer it is run on with a date and time stamp. Also id store a log copy locally for other purposes.

Ignore my blabberings... good job

EDIT

The only thing i didnt care for was the wan ip msgbox

it would be better to display it in the gui itself without making a popup box

Edited by Wus
Link to comment
Share on other sites

Nice.

Suggestions:

* Throw in the @SW_HIDE parameters to the DOS comspec windows.

* If the adapter is on a router (i.e. 192.168....), include the WAN IP without needing to click the button.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...