Markir Posted February 20, 2005 Posted February 20, 2005 Hello, there is a super macro "@IPAddress1". Give it macros for "subnet mask", gateway, "dns1" & "dns2", too? Thank you for helping me!
Markir Posted February 23, 2005 Author Posted February 23, 2005 Have somebody an ieda, how I can get the other informations? Thank you for help
SlimShady Posted February 23, 2005 Posted February 23, 2005 You can redirect CMD output to a text file. And parse it with AutoIt. Functions you need: RunWait(@ComSpec & " /c ipconfig /all > SomeFile.log") FileOpen("SomeFile.log", 0) StringSplit() StringTrimLeft StringTrmRight
Markir Posted February 23, 2005 Author Posted February 23, 2005 Can you give me an example for the Value "Hostname"?
ZeDMIN Posted February 23, 2005 Posted February 23, 2005 RunWait(@ComSpec & " /c ipconfig /all > c:\compinfo.log") $file = FileOpen("c:\compinfo.log", 0) $line = FileReadLine($file) While Not StringInStr($line, 'Hostname') $line = FileReadLine($file) WEnd $hn = StringTrimLeft($line, StringInStr($line, ': ')+1) MsgBox(0, '', $hn)
ZeDMIN Posted February 23, 2005 Posted February 23, 2005 (edited) If you need several things, try this code. Alter content of $search_for to those things you need, separated by commas. $search_for = 'Hostname,DNS-Server,Gateway' $array = StringSplit($search_for, ',') Dim $result[$array[0]+1] RunWait(@ComSpec & " /c ipconfig /all > c:\compinfo.log") $file = FileOpen("c:\compinfo.log", 0) $line = FileReadLine($file) While @error=0 For $i = 1 To $array[0] If StringInStr($line, $array[$i]) Then $result[$i] = StringTrimLeft($line, StringInStr($line, ': ')+1) EndIf $line = FileReadLine($file) Next WEnd FileClose($file) For $i = 1 To $array[0] MsgBox(0, '', $array[$i] & ': ' & $result[$i]) Next Edited February 23, 2005 by ZeDMIN
Markir Posted February 23, 2005 Author Posted February 23, 2005 Oh thank you that is a good idea, because I need more informations, but in that code I see the Value "Hostname:PC01", and the word Hostname don't be displayed
ZeDMIN Posted February 23, 2005 Posted February 23, 2005 For $i = 1 To $array[0] MsgBox(0, '', $array[$i] & ': ' & $result[$i])Next<{POST_SNAPBACK}>In the MsgBox: The array[$i] is the name of the thing you were looking for. If you only want the result you only have to take result[$i].Was that what you were asking for?
Markir Posted February 23, 2005 Author Posted February 23, 2005 (edited) Yes, that was I am asking for. Thank you for coding. But then the results of the second, third information will be displayed as "0" Edited February 23, 2005 by Markir
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