Descrição:
Como executar um ping em um equipamento externo a rede que está rodando o aplicativo?
Solução:
Uma possibilidade é através dos scripts do E3 com comandos do VBScript.
Exemplo de script:
dim oShell, strComputer
set oShell = CreateObject("WScript.Shell")
strComputer = InputBox("Type the IP address you want to ping:", "Ping")
if strComputer <> "" then
' Ping Command options: timeout = 200 ms; number of echo requests = 1
if oShell.Run("ping " & strComputer & " -w 200 -n 1", 0, true) = 0 then
MsgBox strComputer & " responded to ping.", 0, "Ping OK"
else
MsgBox strComputer & " did not respond to ping", 0, "Ping Fail"
end if
end if
- dim oShell, strComputer
- set oShell = CreateObject("WScript.Shell")
- strComputer = InputBox("Type the IP address you want to ping:", "Ping")
- if strComputer <> "" then
- ' Ping Command options: timeout = 200 ms; number of echo requests = 1
- if oShell.Run("ping " & strComputer & " -w 200 -n 1", 0, true) = 0 then
- MsgBox strComputer & " responded to ping.", 0, "Ping OK"
- else
- MsgBox strComputer & " did not respond to ping", 0, "Ping Fail"
- end if
- end if
dim oShell, strComputer
set oShell = CreateObject("WScript.Shell")
strComputer = InputBox("Type the IP address you want to ping:", "Ping")
if strComputer <> "" then
' Ping Command options: timeout = 200 ms; number of echo requests = 1
if oShell.Run("ping " & strComputer & " -w 200 -n 1", 0, true) = 0 then
MsgBox strComputer & " responded to ping.", 0, "Ping OK"
else
MsgBox strComputer & " did not respond to ping", 0, "Ping Fail"
end if
end if
Observação: A aplicação exemplo em anexo foi feita usando o E3 3.1 Build 270.
Anexos:
AppPing