Solved

Scripting - Modify Send button - multiple batches

Posted on 2003-12-01
12
284 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
ID: 9851841
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
ID: 9851859
possible, I would like to focus on accessing the RTF field -  Body, any ideas?
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9852014
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
ID: 9852033
Well partha covered it pretty much.

0
 

Author Comment

by:ba_pepper
ID: 9852311
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9852336
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
ID: 9853193
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
ID: 9857509
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
ID: 9857514
close this problem
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9872485
Ask for a refund using community support.
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 9892411
PAQed, with points refunded (125)

SpazMODic
EE Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

12 Experts available now in Live!

Get 1:1 Help Now