This one was perfect!! Waltz did a great job.
;Function Revping()
;
;Author Waltz
;
;Contributors jpols - Jochen Polster (jochen.polster@gmx.net)
; http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=12;t=000012#000000
;
;Action Reverse ping an IP Address to resolve a Host Name
;
;Syntax REVPING("IPADDRESS")
;
;Version 2.0
;
;Parameters ipaddress
; - must be in the format "###.###.###.###"
; - do NOT pad ### with leading 0's (zero's)
;
;Remarks - cribbed from jpols Ping()
;
;Returns - if resolved, the Host Name associated with the IP Address
; - if resolved, sets @ERROR exit code to 0
; - if not resolved, "UNRESOLVED"
; - if not resolved, sets @ERROR exit code to 1
;
;Dependencies None
;
;KiXtart Ver 4.10a
;
;Examples
; $hostname = REVPING("81.17.37.55")
;
; $ipnum = "1.2.3.4"
; $hostname = REVPING($ipnum)
;
FUNCTION REVPING($ipnum)
DIM $nameip, $tempfile
$tempfile = "%temp%\nameip.txt"
SHELL '%Comspec% /Q /E:1024 /C FOR /F "TOKENS=2* DELIMS= " %%i IN ('+ CHR(39)
+ '"PING -a -n 1 $ipnum | FIND "]""' + CHR(39) + ') DO ECHO %%i >' + $tempfile
IF OPEN(10,$tempfile,2) = 0 $nameip = READLINE(10) ELSE $nameip = "" ENDIF
IF CLOSE(10) = 0 DEL $tempfile ENDIF
IF $nameip <> "" $revping = TRIM($nameip) EXIT (0) ELSE $revping = "UNRESOLVED" EXIT (1) ENDIF
ENDFUNCTION