Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Forall a In db.Agents
If ( a.Name = "CalculateTotals" ) Then
Call a.Remove
End If
End Forall
' Self-destructing agent created 08/18/95 by N. Allen
Dim session As New NotesSession
Dim agent As NotesAgent
Set agent = session.CurrentAgent
Call agent.Remove
このスクリプトは、現在のユーザーが所有する無効なエージェントを NotesAgent 型の配列で保持します。この配列は 10 個の要素を持つ配列として宣言されています。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim agentArray( 1 To 10 ) As NotesAgent
Dim count As Integer
Dim r As String
Set db = session.CurrentDatabase
count = 0
' find agents owned by current user and disabled
Forall a In db.Agents
If ( a.Owner = session.UserName ) And _
Not ( a.IsEnabled ) Then
count = count + 1
Set agentArray( count ) = a
End If
End Forall
r = Inputbox$( "You have " & count & _
" disabled agents. Delete them?" )
If ( r = "yes" ) Or ( r = "y" ) Then
' go through each agent that's owned by current
' user and disabled
Forall b In agentArray
Call b.Remove
End Forall
End If
End Sub