Need help or advice?

Call us on
+44 (0) 2077 545 948

PDF Notes

Notes To PDF

Quickly and easily convert Notes to PDF. With only 2 lines of code any Notes / Domino content can be saved as PDF.

Download Now
Ping Host with LotusScript
The Ping LotusScript class allows you to pass in an IP address and return whether the ping was successful or not. The class is useful if you're using DominoPDF via HTTP and want to check availability before converting a URL.

The code below can be created in a script library or the declaration section of an agent.

Private Const TIMEOUT = 500
 
Private Type ICMP_OPT
Replacement As Long
OptionsData As Long
End Type
 
Private Type ICMP_ECHO_REPLY
Address As Long
status As Long
RoundTripTime As Long
DataSize As Long
DataPointer As Long
Options As ICMP_OPT
Data As String * 250
End Type
 
Declare Private Function IcmpCreateFile Lib "icmp.dll" () As Long
Declare Private Function IcmpCloseHandle Lib "icmp.dll" (Byval IcmpHandle As Long) As Long
Declare Private Function IcmpSendEcho Lib "icmp.dll" (Byval IcmpHandle As Long,
Byval DestinationAddress As Long, Byval RequestData As String, Byval RequestSize As Long,
Byval RequestOptions As Long,ReplyBuffer As ICMP_ECHO_REPLY, Byval ReplySize As Long,
Byval REPLY As Long) As Long
Declare Private Function inet_addr Lib "wsock32" (Byval s As String) As Long
 
Class Ping
Private ECHO As ICMP_ECHO_REPLY
 
Public Function Ping ( IP As String ) As Variant
Ping = False
If IcmpCreateFile() Then
Call IcmpSendEcho ( IcmpCreateFile(),inet_addr ( IP ), "", 0, 0, ECHO, Len ( ECHO ), TIMEOUT )
If ECHO.status = 0 Then
Ping = True
Call IcmpCloseHandle ( IcmpCreateFile() )
End If
End If
End Function
End Class

Sample usage for calling the class is below.

Sub Click(Source As Button)
Dim IP As String
Dim Ping As New Ping
IP = "192.168.123.184"
Msgbox Ping.Ping ( IP )
End Sub
Comments (2)add
...
written by Praveen Nair , April 08, 2011
We are evalusting this product as an option for exporting the PDF file.


What error code is provided back when the URl goes down after the ping or something stange happens. Currently it is simply printing a blank page. Since we have bank documents, it may lead to a monitory impact.
...
written by Primeapple , May 04, 2011
DominoPDF can return success (0) or failure (1) from the DoPDF() call. There's also a LogFail=True setting which will suppress creation of a PDF (even if it's blank) so you can check for its [non]existence.
Write comment
smaller | bigger

busy
 

News Feed

Subscribe to the Primeapple RSS News Feed.