Solved

Scripting - Modify Send button - multiple batches

Posted on 2003-12-01
12
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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