[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

Generating .txt files using LotusScript

How can I create text (.txt) files using LotusScript?  The file should be populated with field values from a form.  Then emailed as an attachment and/or stored on a specific folder on the network server(s).
Examples and/or web resources would be extremely useful.
  • 2
1 Solution
An example :

     ' Declarations
     Dim session As New NotesSession
     Dim uiws As New NotesUIWorkspace
     Dim db As NotesDatabase    
     Dim collection As NotesDocumentCollection    
     Dim doc, parameterDoc, begleitDoc As NotesDocument
     Dim tempItem As NotesItem
     Dim i,j As Integer
     Dim intFile As Integer    
     ' Dataset to write
     Dim Dataset (1 To 25) As String
     VarAGesamt, VarBGesamt  as String

     On Error Goto Fehler ' catch errors
     ' Init
     Set db = session.CurrentDatabase
     Set collection = db.UnprocessedDocuments    
     Set parameterDoc = db.GetProfileDocument("Parameter")
    ' Erstelle File
     intFile = Freefile()    
     Open "A:\File.txt" For Output Access Write Lock Read Write As intFile
     ' Init Dataset A
      Dataset(1) = "..."    
      Dataset(2) = "..."
      Dataset(14) = "..."
     For i = 1 To 14
          VarAGesamt = VarAGesamt+Datensatz(i)
    ' write Dataset A
     Print #intFile, VarAGesamt;
    ' Init Dataset B with all selected docs
     For i = 1 To collection.Count
          Set doc = collection.GetNthDocument( i )
          Set tempItem = doc.GetFirstItem("Zahlungsart")
               Datensatz(1) = "0245"
               Datensatz(2) = tempItem.Values(0)

               For j = 1 To 25
                    VarCGesamt = VarCGesamt+Datensatz(j)
              ' write Dataset C
               Print #intFile, VarCGesamt;
               VarCGesamt = ""
          End If
      ' close File
     Close intFile
    Exit Sub
error :
     Msgbox "..."

     '  close File
     Close intFile
     Exit Sub
Ah, I forgot to say that I had the code in an agent and called it over a button.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now