Sign in to follow this  
Followers 0
PerryRaptor

Display HostName or I.P. Address

3 posts in this topic

No break throughs; just sharing...

Need to lookup the ComputerName, HostName, or I.P. Address for an Internet/Network resource?

; Host_IP.au3
;
; Executes the MSDOS Ping command against a targeted Internet or Networked resource
; - Ultimately returning only the I.P. Address or HostName of the target
; - Creates a temporary text file to hold the result of the MSDOS Ping command
; Version 1.0.3 By: PerryRaptor
; ----------------------------------------------------------------------------------
Local $strcomputer,$ip
$strcomputer = @computername
$strcomputer = InputBox("HostName or I.P. Address", "Enter the ComputerName, HostName, or I.P. Address for a remote PC, a web address, or press the {OK} button to show My_IP.", $strComputer, "")

RunWait(@ComSpec & " /C Ping -a -n 1 " & $strcomputer & "> Host_IP.txt",@MyDocumentsDir, @SW_HIDE)
$ip = FileRead(@MyDocumentsDir & "\Host_IP.txt", FileGetSize(@MyDocumentsDir & "\Host_IP.txt"))
FileDelete(@MyDocumentsDir & "\Host_IP.txt")

$ip = StringTrimLeft($ip, StringInStr($ip, "["))
$ip = StringLeft($ip, StringInStr($ip, "]")-1)

MsgBox(0," " & $strcomputer & ":  ", "   " & $ip)

Share this post


Link to post
Share on other sites



Just a thought PerryRaptor for future versions, but you may want to add some error checking in regards to using pings. Many firewalls and routers now block ICMP protocols and you end up with time outs instead of ping values.

Share this post


Link to post
Share on other sites

If you enter an invalid I.P. Address or HostName it returns nothing. Also, the cancel button isn't enabled either.

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
Sign in to follow this  
Followers 0