Running scheduled agents dealing with UI class elements

I wrote an agent that’s supposed to open a database plus a view and deal with the documents in that view. My aim is to to have each document opened in adit mode, save a certain field and close the document for all the documents in that view.

why? Coz I figured this way, if I have say a document with a field “Body” that is in mime format and the document is opened followed by one or two changes, the saved document will have this body field changed from mime to a rti. Then I can be able to manipulate it using the normal richtext class functions without losing the fonts etc.

Now the question is can you have a agent that runs this kind of a scenerio having a workspace opened and document opened and saved etc. The on event one works fine but I then need this agent to run without human interaction.

MY AGENT AS IT STANDS:

Sub Initialize

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim uiview As NotesUIView

Dim server As String

Dim dbase As String

Dim view As NotesView

Dim agentLog As New NotesLog("Agent log")



Call agentLog.OpenAgentLog



server=""

dbase="eDividePart2/eDivideUvimba.nsf"

Call agentLog.LogAction("Opening the database...")

Call workspace.OpenDatabase(server,dbase,"processedInbound","",False,False)

Set uiview = workspace.CurrentView

Set view = uiview.View 

'Messagebox view.EntryCount

count = view.EntryCount

Call agentLog.LogAction("Found " + count + " documents.")

While count >= 1 

     Set doc = view.GetNthDocument(count)

     If Not(doc Is Nothing) Then

          Call agentLog.LogAction("Processing document...")

          Call workspace.EditDocument(True,doc)                    

     End If

     count = count - 1

Wend 

Call agentLog.Close

'Call uiview.Close

End Sub

after the scheduled time, my log file says the agent has run successfully but it’s not printing the information about the agentLog. Any ideas please help.

jay

Subject: running scheduled agents dealing with UI class elements

Jay,

I’m afraid that sheduled agents cannot run with UI calsses. This is from the NotesUIWorkspace Help:

“You cannot use the UI classes in a background agent, an agent called through an API, or an agent called by the NotesAgent Run method. Only workstation users can run scripts that access UI objects.”