OpenNTF.org - Export to Text (Lotus Script)
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Export to Text (Lotus Script) 
Rating:
Not Rated Yet 
Contributor:
Ted (ewizard2) Ford 
Category:
Lotusscript 
Type:
Example Code 
Document Release:
Tested in 6.5.4 and 5.13a 
Notes Version:
R5.x, R6.x 
Last Modified:
21 Dec 2005 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
This script will export Domino Data using lotus script to a text file. This example will retrieve notes.ini variables and send them to a text file.
Usage / Example
'to prevent error for directory already created with mkdir line

On Error Resume Next

' Initialize variables
Dim session As NotesSession
Dim curdb As NotesDatabase
Dim ClientDataPath As String
Dim IdFileOnClient As String
Dim idFileNewOnClient As String
Dim ClientLocationDoc As String
Dim ClientMailSrv As String
Dim ClientMailFile As String
Dim wordobj As Variant

'Get session and database
Set session = New NotesSession
Set curdb = session.CurrentDatabase

' Get Client notes.ini information
ClientLocationDoc = session.GetEnvironmentString("Location",True)
ClientMailSrv = session.GetEnvironmentString("MailServer",True)
ClientMailFile = session.GetEnvironmentString("MailFile",True)
ClientDataPath = session.GetEnvironmentString("Directory",True)
IdFileOnClient = session.GetEnvironmentString("KeyFilename",True)
If Instr(idFileOnClient,"\")<>0 Then
IdFileNewOnClient = Strrightback(IdFileOnClient,"\")
Else
idFileNewOnClient = IdFileOnClient
End If

'Create first text file

' Used to create first file
fileNum% = Freefile()
Mkdir "c:\stagingr6"
fileName$ = "c:\stagingr6\notes.ini"

' Write But notes.ini information.
Open fileName$ For Output As fileNum%
Print #fileNum%, "[Notes]"
Print #fileNum%, "KitType=1"
Print #fileNum%, "SharedDataDirectory=C:\Documents and Settings\All Users\Application Data\Lotus\Notes\Data\Shared"
Print #fileNum%, "Directory=C:\Documents and Settings\%username%\Application Data\Lotus\Notes\Data\Shared"
Print #fileNum%, "MailServer=" & ClientMailSrv
Print #fileNum%, "MailFile=" & ClientMailFile
Print #fileNum%, "Location=" & ClientLocationDoc
Print #fileNum%, "StackedIcons=1"
Print #fileNum%, "TCPIP=TCP,0,15,0"
Print #fileNum%, "Ports=TCPIP"
Print #fileNum%, "KeyFileName=" & IdFileNewOnClient
Print #fileNum%, "TemplateSetup=600400"
Print #fileNum%, "Setup=650200"
Close fileNum%

' Used to create second file
fileNum2% = Freefile()
fileName2$ = "c:\stagingr6\dataFolder.txt"

' Write put data folder location
Open fileName2$ For Output As fileNum2%
Print #fileNum2%, ClientDataPath
Close fileNum2%

End Sub

 Comments
Posted by Patrick Mulligan on 02/22/2006 05:05:29 PMA question concerning suitability...
I am a new to developing in lotus and need to export field data from an open document (button activated) to output to a txt file. The file then gets picked up by our barcode software and shipping labels are created.
The file needs to have delimited (or fixed-width) fields of data from Lotus with NO hard carriage returns; The file does NOT require a header row.
Is your script for exporting to a text file compatible with these requirements?
Any advice is much appreciated.
Thanks
Patrick M
 Add your comment!