I am an administrator, not a developer, and I need some help adding a user prompt to some script. The script would either continue to run if the user choses “ok”, or it would stop if the user choses “cancel”. I’ve been able to do this with a message box in a different script, but cannot get it to work here. I have used the Help in designer and have been unsuccessful.Any assistance would be greatly appreciated. Here is the lotusscript:
Sub Click(Source As Button)
Const SPAMREPORTADDRESS = "test@cox.net" 'the email address used to report spam, uncomment to go live
Dim sess As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim memo As NotesDocument, doc As NotesDocument
Dim col As NotesDocumentCollection
Dim mime As NotesMIMEEntity
Dim rtitem As NotesItem
Dim temp As Variant 'to get info from non-ASCII data
Dim i As Integer 'to count messages
Dim uiview As NotesUIView 'to update the inbox after messages have been moved
Dim mail As NotesRichTextItem 'the sent message
Dim item As NotesItem 'to process fields with multiple items (i.e. recieved)
sess.ConvertMime = False 'init mime conversion
Set db = sess.CurrentDatabase
Set col = db.UnprocessedDocuments
Set doc = col.GetFirstDocument()
If doc Is Nothing Then Exit Sub 'sanity check to abort early
Print "Reporting " + Cstr( col.Count ) + " selected documents as Spam to " + SPAMREPORTADDRESS + ". Please wait..."
i = 1
While Not(doc Is Nothing)
Set memo = db.CreateDocument
Set mail = New NotesRichTextItem( memo, "Body" )
Set mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then
Forall header In mime.HeaderObjects
Call mail.AppendText( walkmime ( mime ) ) 'calls required function walkmime
End Forall
Call doc.CloseMIMEEntities 'allow clean switch to using items
If Instr( doc.Subject(0), "SPAM Submission" ) = 0 Then
Call doc.ReplaceItemValue("Subject", "SPAM Submission > " + doc.Subject(0) ) 'remove [spam]
End If
memo.subject = doc.subject(0)
Call memo.Send( False, SPAMREPORTADDRESS) 'forward spam report message
Print "Successfully reported message " Cstr(i) + " of " + Cstr( col.Count ) +" ("+ doc.Subject(0) + ")"
Else
Print "No MIME content found in message, not sending spam report. (the internet message may have been converted to Notes Format)"
End If
Call doc.Remove(True)
Call ws.ViewRefresh
Call sess.UpdateProcessedDoc( doc )
i = i +1 'increment counter
Wend
Set uiview = ws.CurrentView
Call uiview.DeselectAll 'to prevent UI bugs
sess.ConvertMime = True 'revert mime conversion
Beep
Print "Done reporting " + Cstr( col.Count ) + " document(s) as Spam."
End Sub
Function walkmime (mime As notesmimeentity) As String
'returns string of complete mime message
Dim mime2 As notesmimeentity 'for walking mime tree
walkmime = "" 'init string
While Not (mime Is Nothing)
walkmime = walkmime & Chr(10) _
& mime.Headers & Chr(10) _
& mime.ContentAsText
Set mime2 = mime.GetFirstChildEntity 'get first child:
If mime2 Is Nothing Then 'none? then get next sibling
Set mime2 = mime.GetNextSibling
End If
If mime2 Is Nothing Then 'none? then get aunt/uncle :
Set mime2 = mime.GetParentEntity
If Not (mime2 Is Nothing) Then
Set mime2 = mime2.GetNextSibling
End If
End If
Set mime = mime2
Wend
End Function