Sephiroth
http://sephiroth.scifi-action.de/board/

$_ping
http://sephiroth.scifi-action.de/board/viewtopic.php?f=4&t=47
Seite 1 von 1

Autor:  Sephiroth [ 18. März 2008 00:29 ]
Betreff des Beitrags:  $_ping

;; Simple alias using com objects to test if a IP/Host is pingable
;; $_ping(host)
;; returns Time=Xms
;; or
;; returns $false

alias _ping {
  var %x = $ticks,%p = $$1,%f = c:\ $+ %p $+ .txt
  if ($com(ping $+ %x)) { .comclose ping $+ %x }
  .comopen ping $+ %x WScript.Shell
  if !$comerr { .comclose ping $+ %x $com(ping $+ %x,Run,3,bstr,cmd.exe /c ping %p -n 1 -w 1000 > %f,uint,0,bool,true) }
  %p = $read(%f,n,4)
  if (: isin %p) { .remove %f | return $gettok($gettok(%p,2-,58),2,32) }
  else { .remove %f | return $false }
}

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/