I wrote an agent that asks for a comment "prefix" via an inputbox, then runs through all the design elements in a database that accept comments and either puts the entered value in the $Comment field, or prepends the entered value to an existing comment (e.g. "newvalue - original comment"). Note that I couldn't get views to work using the NotesNoteCollection approach so I fell back to using Damien Katz's DbDesign class for views (look here:
http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/11f180e35d280d38852568b7005c0382?OpenDocument&Highlight=0,dbdesign). Just add the script library from that download to your database and this agent will compile properly.
************ begin code ******************
'Update Comment on All Elements:
Option Public
Use "DbDesign"
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim nc As NotesNoteCollection
Dim note As NotesDocument
Dim nid As String
'Instantiate DBDesign objects for views, which don't work with NotesNoteCollection
Dim dbdesign As DatabaseDesign
Dim views As Variant
Dim viewaliases As Variant
Dim CommentString As String
CommentString$ = Inputbox$("Enter a Comment String (will prepend any existing comment):")
If CommentString$ = "" Then
Messagebox "Action Cancelled"
Exit Sub
End If
Set db = session.CurrentDatabase
Set dbdesign = createDatabaseDesign( db)
views = dbDesign.viewDocuments
Set nc = db.CreateNoteCollection(False)
'Choose elements where $Comment field is present
nc.SelectFramesets = True
nc.SelectPages = True
nc.SelectForms = True
'Views treated as a special case because of NotesNoteCollection bug
' nc.SelectViews = True
If Not Isempty( views) Then
Forall viewdoc In views
If Instr(viewdoc.~$Comment(0), CommentString$) = 0 Then
'If the comment string doesn't already exist in this comment, prepend it
If viewdoc.~$Comment(0) <> "" Then
'insert a dash after string to separate it from existing comment
viewdoc.~$Comment = CommentString$ + " - " + viewdoc.~$Comment(0)
Else
viewdoc.~$Comment = CommentString$
End If
Call viewdoc.Save(True, False)
End If
End Forall
End If
nc.SelectFolders = True
nc.SelectAgents = True
nc.SelectOutlines = True
nc.SelectSubforms = True
nc.SelectScriptLibraries = True
nc.SelectImageResources = True
nc.SelectStyleSheetResources = True
nc.SelectDataConnections = True
'Missing files, applets, web services - might work to select all elements then deselect ones that won't apply
Call nc.BuildCollection
If nc.Count = 0 Then
Messagebox "No elements found"
Exit Sub
End If
nid = nc.GetFirstNoteId
While nid <> ""
Set note = db.GetDocumentByID(nid)
If Instr(note.~$Comment(0), CommentString$) = 0 Then
'If the comment string doesn't already exist in this comment, prepend it
If note.~$Comment(0) <> "" Then
'insert a dash after string to separate it from existing comment
note.~$Comment = CommentString$ + " - " + note.~$Comment(0)
Else
note.~$Comment = CommentString$
End If
Call note.Save(True, False)
End If
nid = nc.GetNextNoteId(nid)
Wend
Messagebox "Finished"
End Sub