Hello everyone.
Do you know a more elegant way to accomplish this task?
I see a small window to open in the Windows taskbar.
(defun c:pingtest (/ ping)
(defun ping (adress / pingStatus objShell)
(vl-load-com)
(setq objShell (vlax-get-or-create-object "WScript.Shell"))
(setq pingStatus
(vl-catch-all-apply
'vlax-invoke-method
(list
objShell
"Run"
(strcat "ping -n 1 " adress)
6
:vlax-true
) ;_ >list
) ;_ >vl-catch-all-apply
) ;_ >setq
(vlax-release-object objShell)
(gc)
(cond
(
(= 0 pingStatus)
(setq pingStatus t)
)
(
(= 1 pingStatus)
(setq pingStatus nil)
)
(
(vl-catch-all-error-p pingStatus)
(vl-catch-all-error-message pingStatus)
(setq pingStatus nil)
)
) ;_ >cond
) ;_ >defun
(if (ping "www.theswamp.org")
(princ "Status: online")
(princ "Status: offline")
) ;_ >if
(princ)
) ;_ >defun
Best regards
Luís Augusto