Lotus Notes FAQ Visit Our Sponsor!

Can you run an Agent from LotusScript?

Using LotusScript under Windows, you can use OLE Automation of Notes to run an agent:
  Set s = CreateObject("Notes.NotesSession")
  Set db = s.GETDATABASE("", "db.nsf")
  Set a = db.GETAGENT("SomeAgent")
  Call a.RUN

Parameters are passed to the agent using environment variables.

You can also run the agent directly:

  ' from Gary_VanCott@nvhin.com
  Dim db As New NotesDatabase("", "")
  Dim Agent As NotesAgent
  If (db.open("ServerName/Domain", "path\filename.nsf")) Then
    Set Agent = db.GetAgent("Agent Name")
    If Not(Agent Is Nothing) Then
      Call Agent.Run
      Msgbox "Agent not found..."
    End If
  Call db.close
  End If

Applies to Notes Versions: 4, 4.5, 4.6, 5
Last Modified: March 19, 1999