例: CurrentAgent property

  1. 次のエージェントスクリプトは、現在実行されているエージェントの名前を取得し、その名前を agentName に代入します。例えば、このスクリプトが Super Agent の一部である場合、Name プロパティは「Super Agent」を返します。
    Dim session As New NotesSession
    Dim agent As NotesAgent
    Dim agentName As String
    Set agent = session.CurrentAgent
    agentName = agent.Name
  2. 次のエージェントスクリプトは、現在実行されているエージェントのメールログを作成します。このログの名前は現在のエージェントと同じです。また、現在のエージェントの所有者にメールで送信されます。
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim agent As NotesAgent
      Set db = session.CurrentDatabase
      Set agent = session.CurrentAgent
      Dim currentLog As NotesLog
      Set currentLog = New NotesLog( agent.Name )
      Call currentLog.OpenMailLog _
      ( agent.Owner, agent.Name & " in " & db.Title )
      '...log some actions and errors...
      Call currentLog.Close
    End Sub