Notes Documents to PDF (based on Lotus Form)

140 pts.
Tags:
Lotus Domino 6.5
Lotus Domino 6.x
Lotus Notes
LotusScript
PDF
Lotus Domino 6.5 OK we have a Time keeping system that we used in the past. We have a audit requirement and would like to automate the collection of information needed. Typically I would open the database, select the view, select the documents and print to PDF from form typlate. I am not the database designer but I now know more than everyone in my company which is about what I have told you above :). My end goal is to extract each document as a PDF to a directory. I have attempted this with a LotusScript Agent doing a UI.Print to a CutePDF Writer printer but I can not set the file name. Note I am doing Keybd_events to navigate the menu but once I hit the ok button I can't send any more to it for the file name prompt. code below... I am sure its a hack of a script... :) I have no training or prior knowledge except a previous script that I had help on from this forum. There is 73,165 items in the database, of which PDF's needed for 47,245.... :) Please tell me someone has something... price needs to be FREE...
Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim collection As NotesDocumentCollection
	Dim doc As NotesDocument 
	Dim vw As NotesView
	Dim frm As NotesForm
	
	Set db = session.CurrentDatabase
	Set collection = db.AllDocuments
	Set doc = collection.GetFirstDocument() 
	
	Dim uiworkspace As New NotesUIWorkspace
	Dim uidb As NotesUIDatabase
	Dim uivw As NotesUIView
	
	Set uivw = uiworkspace.CurrentView
	Msgbox ("Set to CutePDF and Cancel")
	Call uivw.Print
	
	Dim Form As String
	Dim fDate As String
	Dim fDept As String
	Dim fName As String
	Dim fEmpl As String
	Dim fType As String
	Dim FileName As String
	
	Dim Counter As Long	
	Dim CountDirect As Long
	Dim CountAll As Long
	Dim CountIndirect As Long
	
	Counter = 0
	CountDirect = 0
	CountAll = 0
	CountIndirect = 0
	
	While Not(doc Is Nothing)  
		If Counter < 300 Then
			Forall o In doc.Items
				If Isarray(o.values) Then
					Form = Cstr(o.values(0))
					If Cstr(o.values(0)) = "Time Card" Or Cstr(o.values(0)) = "Time Card for PWS"  Then
						Form = Cstr(o.values(0))
						Forall oo In doc.Items
							If Cstr(oo.Name) = "EmployeeNumber" Then
								fEmpl = Cstr(oo.values(0))
							Elseif Cstr(oo.Name) = "DepartmentNumber" Then
								fDept = Cstr(oo.values(0))
							Elseif Cstr(oo.Name) = "WeekEnding" Then
								fDate = Cstr(oo.values(0))
							Elseif Cstr(oo.Name) = "Employee" Then
								fName = Cstr(oo.values(0))
							Elseif Cstr(oo.Name) = "Type" Then
								fType = Cstr(oo.values(0))
							End If
						End Forall
						CountAll = CountAll +1
					'uivw.SelectDocument(doc)
							'Print To PDF Here.
						If fType = "INDX" Then
							CountIndirect = CountIndirect +1
						End If
						If fType = "PHX" Then
							CountDirect = CountDirect +1
							'Msgbox(fName + " Printing Direct")
%REM							
							Sleep(.2)
							keybd_event 18,0,0,0 ' Alt down
							keybd_event 66,0,0,0 ' B down
							keybd_event 66,0,2,0 ' B up
							keybd_event 18,0,2,0 ' Alt up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							
							keybd_event 39,0,0,0 ' RightArrow down
							keybd_event 39,0,2,0 ' RightArrow up
							
							keybd_event 39,0,0,0 ' RightArrow down
							keybd_event 39,0,2,0 ' RightArrow up
							
							keybd_event 18,0,0,0 ' Alt down
							keybd_event 70,0,0,0 ' F down
							keybd_event 70,0,2,0 ' F up
							keybd_event 18,0,2,0 ' Alt up		
							
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							keybd_event 9,0,0,0 ' Tab down
							keybd_event 9,0,2,0 ' Tab up
							
							keybd_event 13,0,0,0 ' enter key down
							keybd_event 13,0,2,0 ' enter key up
	
                    'will stop here... will not type F in the FileName Prompt			

                     keybd_event 70,0,0,0 ' F down
							keybd_event 70,0,2,0 ' F up
							
							uivw.Print
						End If		
						
						fDate = strreplace("/","-",fDate)
						FileName = fDate + "_" + fDept + "_"+ fEmpl + "_" + fName + ".PDF"
						Msgbox (FileName)
%END REM
							
							
							
						End If
					Else
					'Form = Cstr(o.values)
						If Cstr(o.values) = "Time Card" Or Cstr(o.values) = "Time Card for PWS" Then
					'	Form = Cstr(o.values)
					     'Need To Handle Time Card If This Gets Triggered
							Msgbox ("Need To Handle Time Card If This Gets Triggered")
						End If
					End If
				End Forall
				Counter = Counter +1
	'Else
			'Msgbox("CountDirect = " + Cstr(CountDirect) + Chr(10) + Chr(13) + "CountIndirect = "+Cstr(CountIndirect)+Chr(10)+Chr(13)+"CountAll = "+Cstr(CountAll))												
			'End
			End If
		'IF  Form = "Time Card" | Form = "Time Card for PWS"
			Print "CountDirect = " + Cstr(CountDirect) + " CountIndirect = "+Cstr(CountIndirect)+" CountAll = "+Cstr(CountAll)+" Counter = "+Cstr(Counter)
			Set doc = collection.GetNextDocument(doc)
		Wend
		Msgbox("CountDirect = " + Cstr(CountDirect) + Chr(10) + Chr(13) + "CountIndirect = "+Cstr(CountIndirect)+Chr(10)+Chr(13)+"CountAll = "+Cstr(CountAll))
End Sub



Answer Wiki

Thanks. We'll let you know when a new response is added.

you probleme is the tools you use to print to PDF. cute PDF can not be scripted. use something hels like the reale PDF writer or other. their is some toold that can scritp pdf out their. I just don’t remember them. but you can find them

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following