Pages

Tuesday, December 22, 2009

%TEMP% - Temporary Folder path in Lotussscript

'**********************************************************************************
'@Author : Karthikeyan A
'@Purpose : To get the folder path of the windows temp folder configured in Notes.ini
'@Type : Function
'@Name : getTempFolderPath
'@Return : String (path of the temp folder)
'************************************************************************************
Function getTempFolderPath() As String

'declare the session object to refer the current user's session
Dim session As New notessession

'variable to hold the path of the temp folder
Dim tempDir As String

'get the mentioned environment string value from the notes.ini file
tempDir = session.GetEnvironmentString("SU_FILE_CLEANUP",True)

'the above value shall return a value like "C:\DOCUME~1\....\Temp\smkits"
'skip the contents after the word Temp in the string
tempDir=Strleftback(tempDir,"\")

'return the resultant as the temp folder's path
getTempFolderPath=tempDir
End Function

3 comments:

  1. Following seems to be good solution too...

    Dim GetSystemTempFolder As String
    'Get the temp folders file path to save excel sheet
    Select Case session.Platform
    Case "Macintosh", "Linux", "UNIX"
    GetSystemTempFolder = "/tmp"
    Case "Windows/32"
    GetSystemTempFolder = Environ("TEMP")
    Case Else
    End Select

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I want to access local temp directory from browser using lotusscript

    ReplyDelete