例: NumActions property (NotesLog - LotusScript®)

  1. 次のスクリプトはログに記録されるアクションの数を取得して、変数 count に代入します。ここでは NumActions は 2 を返します。
    Dim currentLog As New NotesLog( "Database log" )
    Dim count As Integer
    Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
    Call currentLog.LogAction( "This is action number one" )
    Call currentLog.LogAction( "This is action number two" )
    count = currentLog.NumActions
  2. 次のエージェントスクリプトはデータベースにアクションとエラーのログを記録します。そして、メールメモをエージェントの所有者に送信して、スクリプトが記録したアクション数を知らせます。例えば、Susanna Tallan が Thread Agent を所有し、エージェントが記録するアクションが 5 つのとき、スクリプトは [Subject] に「Thread Agent logged 5 actions」を含むメールメモを Susanna に送信します。
    Sub Initialize
      Dim session As New NotesSession
      Dim agent As NotesAgent
      Dim db As NotesDatabase
      Dim doc As NotesDocument
      Set agent = session.CurrentAgent
      Set db = session.CurrentDatabase
      Dim currentLog As New NotesLog _
      ( "Log for " & agent.Name )
      Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
      '...log some actions and errors...
      Set doc = New NotesDocument( db )
      doc.Form = "Memo"
      doc.Subject = agent.Name & " logged " & _
      currentLog.NumActions & " actions"
      Call doc.Send( False, agent.Owner )
    End Sub