Front-end script problems

Hi, I’m working with lotus script.

My problem is open a new lotus window (as a new email message) without send it (the user have to fill some fields first).

This is the script I use:

'**********************************************

Set NotesUIWorksp = CreateObject(“Notes.NOTESUIWORKSPACE”)

Set NotesSess = CreateObject(“Notes.NotesSession”)

strMailServer = NotesSess.GETENVIRONMENTSTRING(“MailServer”, True)

strMailFile = NotesSess.GETENVIRONMENTSTRING(“MailFile”, True)

NotesUIWorksp.OPENDATABASE strMailServer, strMailFile

Set NotesUIDB = NotesUIWorksp.GETCURRENTDATABASE()

Set NotesDB = NotesUIDB.Database()

Set NotesDoc = NotesDB.CREATEDOCUMENT()

Set NotesUIDoc = NotesUIWorksp.EDITDOCUMENT(True, NotesDoc)

NotesUIDoc.FIELDSETTEXT “EnterSendTo”, “test@mail.com

NotesUIDoc.FIELDSETTEXT “EnterCopyTo”, “”

NotesUIDoc.FIELDSETTEXT “EnterBlindCopyTo”, “”

NotesUIDoc.FIELDSETTEXT “Subject”, “Test”

NotesUIDoc.FIELDAPPENDTEXT “Body”, “Test”

'**********************************************

When I run this script sometimes it doesn’t work. It seems a sync problem when I try to fill a field and the window isn’t still created.

The error I have is:

Run time error (80010105)

Automation error

The server threw an exception

on NotesUIWorksp.EDITDOCUMENT

or

Run time error 91

Object variable or with block variable not set

on NotesUIDB.Database()

thanks in advance

Simone

Subject: NotesUIWorkspace.ComposeDocument

Try using the ComposeDocument method of NotesUIWorkspace. This creates a document in the database you specify using the form you specify, and displays it to the user. You will then be able to use FieldSetText to set the fields.

Subject: I would not use UI methods to set field values

Try setting the values first, then editing the document…

Set NotesUIWorksp = CreateObject(“Notes.NOTESUIWORKSPACE”)

Set NotesSess = CreateObject(“Notes.NotesSession”)

strMailServer = NotesSess.GETENVIRONMENTSTRING(“MailServer”, True)

strMailFile = NotesSess.GETENVIRONMENTSTRING(“MailFile”, True)

NotesUIWorksp.OPENDATABASE strMailServer, strMailFile

Set NotesUIDB = NotesUIWorksp.GETCURRENTDATABASE()

Set NotesDB = NotesUIDB.Database()

Set NotesDoc = NotesDB.CREATEDOCUMENT()

call NotesDoc.ReplaceItemValue(“EnterSendTo”, “test@mail.com”)

call NotesDoc.ReplaceItemValue(“EnterCopyTo”, “”)

call NotesDoc.ReplaceItemValue(“EnterBlindCopyTo”, “”)

call NotesDoc.ReplaceItemValue(“Subject”, “Test”)

call NotesDoc.ReplaceItemValue(“Body”, “Test”)

Set NotesUIDoc = NotesUIWorksp.EDITDOCUMENT(True, NotesDoc)