Archive for Сентябрь 13th, 2008
Emailing a subform from the current UI document
I have provided a sample database with this utility at: http://www.openntf.org/Projects/pmt.nsf/HomeLookup/97CEA8C9251DA3BE862574A2006FA7B8?OpenDocument Emailing a subform from the current UI document I’m sure most of you are familar with the simple @Command([MailForward]) function. @Command([MailForward]) forwards the current document by placing its entire contents into a mail memo which the user then addresses and sends. I was tasked with duplicating this functionality, but for a subform on the current document. Futhermore, the customer wanted to the memo to be executed through the backend and sent via the click of a button. Approach: The key to this accomplishing this task is to isolate the subform in its own form. After the subform isolated, its entire contents can be copied to the clipboard, pasted it into a rich text field, and sent to a specified user. Follow these 3 steps to create the basic forms and code for this utility. Step 1: a.) Create a hotspot button on the subform you wish to email and add this code to the ‘click’ event: (note: In the ‘hide-when’ options of the hotspot button, check the box for hiding when "Copied to the Clipboard") ‘This button will switch the form name of the current document and open the document using the temp form. Dim strOrgForm As String
Dim ws As New NotesUIWorkspace
Set doc = ws.CurrentDocument.Document
Let strOrgForm = doc.Form(0) ‘capture the original form name
doc.ReplaceItemValue "Form", "TempForm" ’switch the form to the temp ‘email’ form. Call ws.EditDocument(False,doc) ‘reopen the document with the ‘temp’ form. doc.ReplaceItemValue "Form", strOrgForm ‘replace the form name back to its original name. —————————————————————————————– Step 2: a.) Create a form in your database and name it "TempForm". b.) Insert the subform from Step 1 into "TempForm"
c.) (optional: If your underlying original form as richtext fields with attachments, add those richtext fields on the tempform in a hidden section. The section must be hidden and the section properties must be set to ‘auto-collapse’ on open. Otherwise the attachments from the main form will appear at the bottom of the email when it is sent. This step is not necessary if your underlying form does not have rich text fields.)
d.) copy and paste the following code into the "PostOpen" event the "TempForm" subform. Dim db As NotesDatabase
Dim ns As New NotesSession
Dim uidoc As NotesUIDocument
Dim docMemo As NotesDocument
Dim ws As New NotesUIWorkspace
Dim ndt As New NotesDateTime("12/31/1899") ‘The postopen event will copy the entire unhidden contents of the form to the user’s clipboard
‘Then it will grab the memo document saved in the database and open it. Set db = ns.CurrentDatabase
Set uidoc = ws.CurrentDocument
Call uidoc.SelectAll
Call uidoc.Copy
Call uidoc.Close Set dcMemo = db.Search(|Form = "Memo"|,ndt,1) ‘Get the Memo document in database. There should only be 1 memo document
If dcMemo.Count = 0 Then ‘If the memo document is not created, than create a new one
‘This code will only execute the first time someone uses this utility. Set docMemo = New NotesDocument(db)
docMemo.ReplaceItemValue "Form", "Memo"
Else
Set docMemo = dcMemo.GetFirstDocument ‘otherwise just get the existing memo document
End If ‘In this example we are sending the subform to the current user. docMemo.ReplaceItemValue "SendTo", ns.CommonUsername
‘If you wish to make the sendto field variable, add a hidden field to the tempform Form, popluate it, and then reference it here like this: ‘docMemo.ReplaceItemValue "SendTo", uidoc.Document.GetFirstItem(your fieldname goes here).Values
docMemo.ReplaceItemValue "CopyTo", "" ‘Add more people to CC if desired
docMemo.ReplaceItemValue "Subject", "Test: Emailing a subform" ‘add a subject to your memo
docMemo.ReplaceItemValue "Body", "" ‘clear the body field each time before opening the memo
Call ws.EditDocument(True,docMemo) ‘Open the Memo document. ———————————————————————————————— Step 3: a.) Create a form in your database and name it "Memo"
b.) Create an editable rich text field on the Memo Form and name it "Body". c.) copy and paste the following code into the "PostOpen" event the "TempForm" subform. Dim uidoc As NotesUIDocument
Dim ws As New NotesUIWorkspace ‘The postopen event of this form will paste the contents of the user’s clipboard into the body field
Set uidoc = ws.CurrentDocument
Call uidoc.Paste ‘paste the subform into the body field of the uidoc (body field is default focus)
Call uidoc.Save ‘the uidoc must be saved to capture the rich text
Call uidoc.Document.Send(False,False) ’send the memo document
Call uidoc.Close
Original source : http://www.openntf.org/projects/codebin/codebin.ns…
Modification of Michael Woehrer’s History Class to show new values
This is an example of how Michael Woehrer’s [<a href="http://www.openntf.org/Projects/codebin/codebin.nsf/0/71E930683C3401A3C1256F2F00611BAA">History Class</a>] can be modified to track the new value as well as the old value.
Original source : http://www.openntf.org/projects/codebin/codebin.ns…
Connect Server Agent to Restricted File Share with Alternate UserName/Password
So the SQL Server guy stop by and says, "Hey, we want to create some reports of Notes data and we only know how to use SQL Server to do it. Do you mind exporting it to a delimited text file and saving it to this restricted folder on the file server? Here’s the username and password of a special Windows account with rights to the folder. Oh, and we need it to run on a scheduled basis so everything is automated. Thanks!" The key here is the use of an alternate username and password to gain access to a restricted folder on a Windows file server. Note: This only works on Domino servers running on Windows. Read more: http://www.lotusguru.com/lotusguru/LGBlog.nsf/d6plinks/20080530-7F5HBT
Original source : http://www.openntf.org/projects/codebin/codebin.ns…
Agent Access Information Required
Hello An Agent X runs on ServerA and this agent has been signed by ServerA
If the same Agent X needs to runs on ServerB duely signed with the signature of ServerA,
what permissions would the Agent require to run successfully on ServerB. Any suggestions please reply Rgds
Roopa
Original source : http://www.openntf.org/projects/codebin/codebin.ns…
Extract data from PDF files – fields, text, pages, bookmarks
This database was created for the purpose of helping people who want to parse values from fields on a PDF form, extract text from PDF files, pull the bookmark names, and extract individual pages from a PDF file. I pulled many of these examples from all over the web via google, and many of them from posts on www.notes.net, and I’m sure I did some searching on openntf.org. I am in no way taking credit for all of this code, but since it came from so many sources, and I did not keep up with them, I just saying it’s not all mine. I simply put about 20 examples into 1 place so that we could all share. Requirements: Built using Notes 7.0.2, also need Adobe Professional. I used Adobe Pro 7.x.. Must also have bookmarks in your PDF file. Again MUST HAVE ADOBE PROFESSIONAL. If you have questions, commnets or suggestions, please feel free to contact me at jason@ciaresearch.com. Be warned that this code is in no way complete. I guessed at many of the things I did in here because I could not find good and complete examples. Please share your thoughts, comments, code improvements with all of us. I will update code if I get any great ideas from people. Thanks for taking a look and I hope this helps many of you. Jason
Original source : http://www.openntf.org/projects/codebin/codebin.ns…
In Place Merge Sort
According to Wikipedia InPlaceMergeSort is a pretty fast sorting algorithm (O(n log n) on average, O(n log n) worst case and O(1) memory usage.) Sub InPlaceMergeSort(vArray As Variant, nLow0 As Integer, nHigh0 As Integer)
Dim nLow As Integer
Dim nHigh As Integer
Dim nMid As Integer
Dim nEndLow As Integer
Dim nStartHigh As Integer
Dim vTemp As Variant
Dim nCount As Integer nLow = nLow0
nHigh = nHigh0
If nLow >= nHigh Then
Exit Sub
End If nMid = (nLow + nHigh) \ 2 Call InPlaceMergeSort(vArray, nLow, nMid)
Call InPlaceMergeSort(vArray, nMid + 1, nHigh) nEndLow = nMid
nStartHigh = nMid + 1 While nLow <= nEndLow And nStartHigh <= nHigh
If vArray(nLow) < vArray(nStartHigh) Then
nLow = nLow + 1
Else
vTemp = vArray(nStartHigh)
For nCount = nStartHigh -1 To nLow Step -1
vArray(nCount + 1) = vArray(nCount)
Next
vArray(nLow) = vTemp
nLow = nLow + 1
nEndLow = nEndLow + 1
nStartHigh = nStartHigh + 1
End If
Wend
End Sub Sub sort(vArray As Variant)
Call InPlaceMergeSort(vArray, Lbound(vArray), Ubound(vArray))
End Sub
Original source : http://www.openntf.org/projects/codebin/codebin.ns…
How to export data From Notes document to MS Word using Lotussscript action button?
Hi! I have a big problem. I need to do the following thing: I have a Notes database where is a lot of documents, when i’m opening one document than there is an Action button which when pressed, opens an MS Word document and export all Notes document data to the MS Word document. The only thing i know, is to open blank Word document with this code (see in Usage/Example), But i don’t know, how to put Notes data into Word document! It’s seems to be a very easy LotusScript but i don’t know how to do that, but i need this Lotus Script with Action Button. Can anyone help me please? I will be very pleased if someone can give a sample code or good advice how to do that or a hyperlink to web page where is information about my problem! Best regards, Guntis!
Original source : http://www.openntf.org/projects/codebin/codebin.ns…