In mail it is in the header, but in own made databases it does not have to be. I have such a database in which amongs others telephone calls are registered. At some point I have to insert date and/or time. Now I have to type it. But I would like to have this task automated. Would you by any chance have any suggestions how I would have to program an agent to have these tasks performed ?
Thanks in advance.
The following code works as an agent run from the actions menu after selecting docs to run it on. I am sure that someone with more knowledge of lotusscript than me (pascal?) can reduce this somewhat. I modified an existing example that I found so that it would do what you were after. Please test on dummy data before trusting this as I am a novice really when it comes to scripting.
Mark.
Sub Initialize
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uiDoc As NotesUIDocument
Dim db As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument
Set db = s.CurrentDatabase
On Error Resume Next
Set uiDoc = ws.CurrentDocument
If Err <> 0 Then
Err = 0
Set uiDoc = Nothing
End If
If uiDoc Is Nothing Then
Set coll = db.UnprocessedDocuments
If coll.Count = 0 Then
Msgbox "Please choose a document to be processed!!", 16, "None Selected"
Exit Sub
End If
Set doc = coll.GetFirstDocument
Else
Set coll = Nothing
Set doc = uiDoc.Document
End If
While Not doc Is Nothing
Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText("Time&Date Stamp:" )
Call rtitem.AppendText(Date$ )
' Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText(" " )
Call rtitem.AppendText(Time$)
Call doc.Save( False, True )
End If
If coll Is Nothing Then
Set doc = Nothing
If uiDoc.EditMode Then Call uiDoc.Reload
If uiDoc.EditMode Then Call uiDoc.Refresh
Else
Set doc = coll.GetNextDocument(doc)
End If
Wend
Thanks for the script / agent, but - if I understood it correctly - it works on selected documents.But I want to use it in a document. And by the way, I get an error. Is there a simple way like a smart icon and then the formula / command @today ?
In a date field you can type Today, Yesterday or Tomorrow and the requisit date will appear.
Beyond that, you're supposed to use the date picker. If there is none, ask the designer to include it. It will make your life easier.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.