Help with very simple lotusscript

hello, can anyone help me with this script on the notes client. I have a button on a view. I want this button to print all the documents in the view to a different form called “printinvite”. I’m trying to move off forumla language and onto lotusscript but I’m stumped with this problem. As always any help appreciated.

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As Notesdatabase

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim view As notesview

Dim workspace As New NotesUIWorkspace



Set db =session.currentdatabase

Set uidoc = workspace.CurrentDocument

Set view = db.GetView("everything")

Set doc = view.GetFirstDocument

While Not (doc Is Nothing)

	

	doc.Form="printinvite"

                            call uidoc.print(1)

	Set doc=view.GetNextDocument(doc)

	

Wend

End Sub

Subject: help with very simple lotusscript

Thanks so much guys!

Linda

Subject: help with very simple lotusscript

Sub Click(Source As Button)

Dim w As New NotesUIWorkspace	

Dim s As New NotesSession

Dim db As Notesdatabase

Dim view As notesview

Dim uidoc As  NotesUIDocument

Dim doc As NotesDocument



Const main_form = "a"

Const print_form = "p"



Set db = s.currentdatabase

Set view = db.GetView("a")



Set doc = view.GetFirstDocument

While Not (doc Is Nothing)

	Call doc.ReplaceItemValue("Form", print_form)

	Call doc.Save(True, True)

	Set uidoc = w.EditDocument(False, doc, True)

	Call uidoc.Print(1, 1, 1)

	Call uidoc.Close

	

	Call doc.ReplaceItemValue("Form", main_form)

	Call doc.Save(True, True)		

	

	Set doc=view.GetNextDocument(doc)

Wend

End Sub

hope it will help you

Subject: help with very simple lotusscript

Code is simple but problem not. You can print current view or current document by uiview or uidoc. Error is that you try print current uidoc not your doc. Solution should be for first

Set notesUIDocument = notesUIWorkspace.EditDocument( [editMode] , [notesDocument] , [notesDocumentReadOnly] , [documentAnchor$] , [returnNotesUIDocument] , [newInstance] )

and print notesUIDocument

for details how to use EditDocument look at help