For testing purposes you often have to test scheduled agents which only run on server. With this agent you can select all scheduled agents in a database and run them on server.
Option Public
Option Declare
Sub Initialize
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim agent As NotesAgent
Dim selAgent As Variant
Dim i As Integer
On Error Goto Fehler
Set db = s.CurrentDatabase
Forall a In db.Agents
If a.Trigger = 1 Then
Redim Preserve varAgent(i)
varAgent(i) = a.Name
i = i + 1
End If
End Forall
selAgent = ws.Prompt( PROMPT_OKCANCELCOMBO, "Auswahl des Agenten", _
"Bitte einen Agenten auswahlen: ", varAgent(0), varAgent)
If selAgent = "" Then Exit Sub
Set agent = db.GetAgent(selAgent)
If agent.RunOnServer = 0 Then
Print "Agent ist gelaufen."
Exit Sub
Else
Msgbox "Agent konnte nicht gestartet werden.", 64, "Hinweis"
End If
Exit Sub
Fehler:
Msgbox "Error (" & Cstr(Err) & " ) -≶ " & Error$(Err), 16, "Agent: Run Agent on Server"
Exit Sub
End Sub
This was first published in December 2002