Ghastly_MIB Posted October 5, 2005 Posted October 5, 2005 Is it posible to convert a IP to net name? Example: 192.168.1.2 TO \\Other_pc 74.25.36.96 To pc_name.internethost.com ?? Thanks, Ghastly_MIB
jefhal Posted October 5, 2005 Posted October 5, 2005 Is it posible to convert a IP to net name?do a ping with the -a parameter. This will work on domains. For home networks you could do net view and then ping what comes back to find a match. ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Ghastly_MIB Posted October 5, 2005 Author Posted October 5, 2005 How can I get that to my AutoIt Application?
GaryFrost Posted October 5, 2005 Posted October 5, 2005 Might want to look at StdoutRead (beta) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Ghastly_MIB Posted October 5, 2005 Author Posted October 5, 2005 (edited) Thanks It worksIf any other one will ever need this, just use this code:#include <Constants.au3> #NoTrayIcon $system = InputBox("System", "Enter the IP"&@CRLF&"This could use some time...", "") If @error Then Exit $run = Run(@ComSpec & " /c ping -a """&$system&"""", @SystemDir, @SW_HIDE, $STDOUT_CHILD) While 1 $line = StdoutRead($run) If @error = -1 Then ExitLoop If StringInStr($line, "[") Then $temp = $line $temp = StringReplace($temp, @CRLF, "") $temp = StringReplace($temp, @CR, "") $temp = StringReplace($temp, @LF, "") $temp = StringSplit($temp, "[") $temp = StringSplit($temp[1], " ") $temp = $temp[$temp[0]-1] ProcessClose("ping.exe") ExitLoop EndIf Wend MsgBox(0, "Name of the system "&$system, $temp)Board search for other members:internet protocol to name Edited October 5, 2005 by Ghastly_MIB
w0uter Posted October 5, 2005 Posted October 5, 2005 (edited) i use this: $s_IP = '64.111.104.70' ConsoleWrite(_INetName($s_IP) & @LF) Func _RunSTD($s_p, $s_wd = @WorkingDir, $s_f = @SW_HIDE) Local $s_r = '', $i_pid = Run($s_p, $s_wd, $s_f, 2) While Not @error $s_r &= StdoutRead ($i_pid) WEnd Return $s_r EndFunc;==>_RunSTD Func _INetName($s_IP) $s_IP = StringRegExp(_RunSTD(@ComSpec & ' /c ping -a -n 1 -l 1 ' & $s_IP), ' .* (.*) \[', 3) Return $s_IP[0] EndFunc ;==>_INetName its faster bc. of the "-n 1 -l 1" parameters. Edited October 5, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
jefhal Posted October 5, 2005 Posted October 5, 2005 (edited) MsgBox(0, "Name of the system "&$system, $temp)Thank you! Minor change to last line:MsgBox(0, "Name of the system " & $system, $temp)The original threw an undeclared variable error, possibly because there was no space between the "&" and the "$"? Edited October 5, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
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