How to get Lotus Notes temporary directory

Using lotus script you can get the temporary directory used by notes. Irrespective of the OS(windows or mac or linux) used for lotus notes, by using following code it is achievable.

' Add below code in declaration section

Declare Function w32_OSGetSystemTempDirectory Lib "nnotes" Alias "OSGetSystemTempDirectory" ( ByVal S As String) As Integer
Declare Function mac_OSGetSystemTempDirectory Lib "NotesLib" Alias "OSGetSystemTempDirectory" ( ByVal S As String) As Integer
Declare Function linux_OSGetSystemTempDirectory Lib "libnotes.so" Alias "OSGetSystemTempDirectory" ( ByVal S As String) As Integer
Const ERR_UNSUPPORTED_PLATFORM = 20300 ' or other value you choose.

' Add below function
' this function GetNotesTempDirectory() will return the temporary directory used by lotus notes.

Function GetNotesTempDirectory() As String
' Returns the path of the temporary directory used by Notes.
Dim session As New NotesSession
Dim d As String * 256
Dim s%
Select Case session.Platform
Case "Linux"
s% = linux_OSGetSystemTempDirectory(d)
Case "Macintosh"
s% = mac_OSGetSystemTempDirectory(d)
Case "Windows/32"
s% = w32_OSGetSystemTempDirectory(d)
Case Else
Error ERR_UNSUPPORTED_PLATFORM, "In GetNotesTempDirectory, platform not supported: " & session.Platform
End Select
GetNotesTempDirectory = Left$(d, s%)
End Function