Markir Posted February 20, 2005 Share 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! Link to comment Share on other sites More sharing options...
Markir Posted February 23, 2005 Author Share Posted February 23, 2005 Have somebody an ieda, how I can get the other informations? Thank you for help Link to comment Share on other sites More sharing options...
SlimShady Posted February 23, 2005 Share 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 Link to comment Share on other sites More sharing options...
Markir Posted February 23, 2005 Author Share Posted February 23, 2005 Can you give me an example for the Value "Hostname"? Link to comment Share on other sites More sharing options...
ZeDMIN Posted February 23, 2005 Share 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) Link to comment Share on other sites More sharing options...
Markir Posted February 23, 2005 Author Share Posted February 23, 2005 @ZeDMIN: Thank you for helping! Link to comment Share on other sites More sharing options...
ZeDMIN Posted February 23, 2005 Share 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 Link to comment Share on other sites More sharing options...
Markir Posted February 23, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
ZeDMIN Posted February 23, 2005 Share 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? Link to comment Share on other sites More sharing options...
Markir Posted February 23, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
ZeDMIN Posted February 24, 2005 Share Posted February 24, 2005 huh? not here. here it works fine. Link to comment Share on other sites More sharing options...
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