Solved

Scripting - Modify Send button - multiple batches

Posted on 2003-12-01
12
283 Views
Last Modified: 2013-12-18
I have a requirement to break a mailing into several batches. The form contains a RichText field (Body) that I am having difficulty with. I have been unsuccesful accessing this field.

old button contents:
REM @Command([MailSend]);
REM @Command([FileSave]);
REM @Command([FileCloseWindow])

new script:
Sub Click(Source As Button)
     On Error Goto ErrorHandler
     
     Dim session As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim db As NotesDatabase
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Set db = session.CurrentDatabase    
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.Document
     
     saveBCC = Evaluate( "@Unique(BlindCopyTo)", doc )
     
     uLimit = Ubound(saveBCC)
     batchSize = 1
     y = 0  
     
     Set sentBCC = doc.GetFirstItem( "BlindCopyTo" )
     doc.BlindCopyTo = ""
     
     For x = 0 To uLimit
          sentBCC .AppendToTextList( saveBcc(x) )
          y = y + 1
          If y >= batchSize Or x = uLimit Then
REM               y =  Evaluate("@MailSend ")
               Call doc.Save( True, True)
               Call doc.Send( False )
               
               Messagebox "sentBcc: " & sentBCC .Text
               y = 0  
               doc.BlindCopyTo = ""
          End If
     Next x  
     Exit Sub
     
ErrorHandler:
     Messagebox "Error " & Err() & ":  " & Error()
     Exit Sub
     
End Sub
0
Comment
Question by:ba_pepper
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
I see this if condition confusing

If y >= batchSize Or x = uLimit Then, which says if y which is initialy 0 +1 >= 1... then resetting it back to 0 in the if condition.. is equivalent to true always. And you are looping x = 0 to ulimit, and again checking x = ulimit doesn't make sense.

What is your intention ?

If you want to breakup bcc field data into certain chunks then you can use counter which will collect subsets of the data and send it.. Also Where is Richtext field ?

~Hemanth
0
 

Author Comment

by:ba_pepper
Comment Utility
possible, I would like to focus on accessing the RTF field -  Body, any ideas?
0
 
LVL 14

Expert Comment

by:p_partha
Comment Utility
U mean u want to manipulate body field .. hope this example helps,
Dim doc As NotesDocument
Dim rtitem As Variant

Set rtitem = doc.GetFirstItem( "Body" )
If rtitem.Type = RICHTEXT Then
  Call rtitem.AddNewLine( 1 )
  Call rtitem.AppendText _
  ( "what ever u want to type u can type" )
End If
Call doc.Save( False, True )

Partha
0
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
Well partha covered it pretty much.

0
 

Author Comment

by:ba_pepper
Comment Utility
needed to focus on the uidoc.... Answer below


Sub Click(Source As Button)
     On Error Goto ErrorHandler
     
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument    
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.Document
     
     uidoc.Send
     
     Exit Sub
     
ErrorHandler:
     Messagebox "Error " & Err() & ":  " & Error()
     Exit Sub
     
End Sub
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
Sub Click(Source As Button)
     On Error Goto ErrorHandler
     
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument    
Dim rt as notesRichTextItem
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.Document
     
set rt = doc.GetFirstItem("Body")
rt.AddNewLine(1)
rt.AppendText( "Here is my line added to the rich text")
Call doc.Send(false)
     
     Exit Sub
     
ErrorHandler:
     Messagebox "Error " & Err() & ":  " & Error()
     Exit Sub
     
End Sub
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Hi ba_pepper,

None of the experts here has any idea whether you still have a problem or not, nor what the problem was.  Is this closed?

Best regards,
qwaletee
0
 

Author Comment

by:ba_pepper
Comment Utility
Sorry should have stated problem resolved.

Look at prior post for answer (code snippet).

The problem was when sending the doc the RTF field ( Body ) was not being included, the solution was send the uidoc.
0
 

Author Comment

by:ba_pepper
Comment Utility
close this problem
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Ask for a refund using community support.
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
Comment Utility
PAQed, with points refunded (125)

SpazMODic
EE Moderator
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now