1. Create a new database and in the Postopen Database Script event paste:
Sub Postopen(Source As Notesuidatabase)
Dim session As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim var As Variant
Dim mail_db As NotesDatabase
Dim doc1 As NotesDocument
Dim doc2 As NotesDocument
Set session = New NotesSession
Set db = session.CurrentDatabase
Set view = db.GetView("($FormulaClassView)")
Set doc1 = view.GetDocumentByKey("Net Send")
Set doc2 = view.GetDocumentByKey("Net Send - Add Person")
Let var = Evaluate( |@MailDBName| )
Set mail_db = session.GetDatabase( var(0), var(1), False )
Call doc1.CopyToDatabase( mail_db )
Call doc2.CopyToDatabase( mail_db )
Msgbox "Thank you for installing Net Send into your mail file.
Please look under Actions in your mail file."
End Sub
2. Create an agent call 'Net Send' that is run once and available from the action menu with the following code:
Function Member( v$, s ) As Integer Dim i% Let i% = -1 If Isarray(s) Then Forall x In s Let i% = i% + 1 If x = v$ Then Goto found_first End If End Forall End If Let i% = -1 found_first: Let Member% = i% End Function Function Explode(Byval s$, Byval div$) As Variant Redim result(0 To 0) As String Dim i%, pos%, oldpos%, skip% oldpos = 1 skip = Len(div) pos = Instr(s, div) Do Until pos = 0 Redim Preserve result(0 To i+1) result(i) = Mid$(s, oldpos, pos-oldpos) i = i + 1 oldpos = pos + skip pos = Instr(oldpos, s, div) Loop result(i) = Mid$(s, oldpos, 32000) Explode = result End Function Sub Initialize Dim session As NotesSession Dim ws As NotesUIWorkspace Dim person_string As String Dim login_string As String Dim person_var As Variant Dim login_var As Variant Dim person_array() As String Dim login_array() As String Dim person As String Dim login As String Dim message As String Dim taskId As Integer Set ws = New NotesUIWorkspace Set session = New NotesSession Let person_string$ = session.GetEnvironmentString( "net_send_person", True ) Let person_var = Explode( person_string$, "," ) Redim person_array(0) Forall x In person_var If Not person_array(0) = "" Then Redim Preserve person_array( Ubound(person_array) + 1 ) End If Let person_array( Ubound(person_array) ) = x End Forall Let login_string$ = session.GetEnvironmentString( "net_send_login", True ) Let login_var = Explode( login_string$, "," ) Redim login_array(0) Forall x In login_var If Not login_array(0) = "" Then Redim Preserve login_array( Ubound(login_array) + 1 ) End If Let login_array( Ubound(login_array) ) = x End Forall If Ubound( person_array$ ) = Ubound( login_array$ ) Then
Let person$ = ws.Prompt( PROMPT_OKCANCELLIST, "Net Send",
"Please select the recipient", person_array(0), person_array$ ) If person$ = "" Then Msgbox "You must select a person" Else Let login$ = login_array( Member( person$, person_array ) ) Let message$ = ws.Prompt( PROMPT_OKCANCELEDIT, person$,
"Please enter you message" ) Let taskId% = Shell( "command.com /C net send " + login$
+ " " + message$, 1) End If Else Msgbox "Your 'net_send_person' and 'net_send_login' environment
variables are screwed!" End If End Sub
3. Create an agent call 'Net Send - Add Person' that is run once and available from the action menu with the following code:
Sub Initialize Dim session As NotesSession Dim ws As NotesUIWorkspace Dim person_string As String Dim login_string As String Dim person As String Dim login As String Set ws = New NotesUIWorkspace Set session = New NotesSession Let person_string$ = session.GetEnvironmentString(
"net_send_person", True ) Let person$ = ws.Prompt( PROMPT_OKCANCELEDIT, "Net Send", "Please
enter the full name of the person you wish to add", "") Call session.SetEnvironmentVar( "net_send_person",
person_string$+","+person$, True ) Let login_string$ = session.GetEnvironmentString(
"net_send_login", True ) Let login$ = ws.Prompt( PROMPT_OKCANCELEDIT, "Net Send",
"Please enter the login of the person you wish to add", "") Call session.SetEnvironmentVar( "net_send_login",
login_string$+","+login$, True ) End Sub
4. Create a view called '($FormulaClassView)' and create a button called 'Rebuild FormulaClass' containing the following code:
Sub Click(Source As Button) Dim objViewDoc As NotesDocument Dim objSession As New NotesSession Dim strClass As String Set objViewDoc = objSession.CurrentDatabase.GetDocumentByUNID(
vw_objUIView.View.UniversalID) Msgbox "Value" & Chr(9) & "Design Elements Shown" & Chr(10) &_ "1 " & Chr(9) & "Documents" & Chr(10) &_ "2 " & Chr(9) & "About this database" & Chr(10) &_ "4 " & Chr(9) & "Forms and Subforms" & Chr(10) &_ "8 " & Chr(9) & "Views, Folders and Navigators" & Chr(10) &_ "16 " & Chr(9) & "Database Title" & Chr(10) &_ "32 " & Chr(9) & "Design Collection (overall information)" & Chr(10) &_ "64 " & Chr(9) & "ACL Note (in compiled format)" & Chr(10) &_ "128 " & Chr(9) & "Unknown" & Chr(10) &_ "256 " & Chr(9) & "Using this database" & Chr(10) &_ "512 " & Chr(9) & "Agents (Shared)" & Chr(10) &_ "1024 " & Chr(9) & "Shared Fields" & Chr(10) &_ "2044" & Chr(9) & "Everything apart from documents" & Chr(10) &_ "2055" & Chr(9) & "Everything",0,"$FormulaClass Values" strClass = Inputbox("Enter the new flags for this view", "Enter flags"
, objViewDoc.~$FormulaClass(0)) If strClass = "" Then Exit Sub Call objViewDoc.ReplaceItemValue("$FormulaClass", strClass) Call objViewDoc.Save(True, True, True) Msgbox "Press Shift-F9 to rebuild the view and apply the change you
just made",0,"$FormulaClass" End Sub
5. In the global declarations for the view paste:
Dim vw_objUIView As NotesUIView
6. In the PostOpen event of the view:
Sub Postopen(Source As Notesuiview) Set vw_objUIView = Source End Sub
7. Sort the first column of the view and paste in the following formula:
@If($TITLE != "";$TITLE;$ACLDigest != "";"<ACL Document>";"")
8. Preview the view in notes and click the 'Rebuild FormulaClass' button. When prompted enter 512 to display agents.
9. Open the database and the two agent should be copied to your mail file.
10. Use the 'Net Send - Add Person' action to create a list of people with their NT login names.
11. Use the 'Net Send' action to send them network messages.
This was first published in March 2002