- This agent displays the Subject item of the current document when
run from a view in the Notes client.
Sub Initialize
Dim session As NotesSession
Set session = New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Messagebox doc.Subject(0),, "Subject"
End Sub
- This agent displays the Subject item of the current document when
run by @Command([ToolsRunMacro]) in a browser.
Sub Initialize
Dim session As NotesSession
Set session = New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Print "<H2>" + doc.Subject(0) + "</H2>"
End Sub
- This agent displays the CGI variable Remote_Addr when run in a
browser by the OpenAgent URL command, or by @Command([ToolsRunMacro])
if Remote_Addr is a field on the form supporting the current document.
Sub Initialize
Dim session As NotesSession
Set session = New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Print "<H2>IP address is " + _
doc.Remote_Addr(0) + "</H2>"
End Sub
- This agent increments a counter. You can use it to track the number
of times a Web page is opened by calling it from WebQueryOpen. The
counter is maintained in a profile document as an item named Access_counter.
An item of the name exists for display purposes only in the document
being opened.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim profile As NotesDocument
Dim num As Double
Dim numStr As String
Set doc = session.DocumentContext
Set db = session.CurrentDatabase
Set profile = db.GetProfileDocument( _
"(AccessCounterProfile)")
numStr = profile.Access_counter(0)
If numStr = " " Or numStr = "" Then
num = 1
Else
num = Cdbl(numStr) + 1
End If
Call profile.ReplaceItemValue( _
"Access_counter", Cstr(num))
Call profile.Save(False, False)
Call doc.ReplaceItemValue("Access_counter", Cstr(num))
End Sub