EML export (with Keybd CRTL+SHIFT+S)

It appears that every now and then people are asking about the EML export.I’ve spent the last 2 days researching this on every forum possible and have concluded that I want to try my first hack of Lotusscript with the keybd commands (shudder).

I have seen the EML export code that has been floating around for years… it is waaay too involved for a hack like me. I also saw a cool class called DXLexporter (again waaay over this guy’s head).

I cobbled together the below code which kinda works, I realize that I’m mixing oil and water…I just can’t tell hpw to get out of this jam.

I think I’m confusing UI with traditional database commands that run in the background. Or possibly my problem is that I’m not shifting ‘focus’ to the opened ‘view’ which my keystrokes are intended for.

If someone can help me out of this jam then I will modify this code snippet to cycle through my entire mail file (5,000 docs) to save each doc to a folder as EML files. I may even get creative and add an index string to the file names so the folder is sortable.

Thanks in advance for any help!

Sub Initialize

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Dim uidoc As NotesUIDocument



Set db = session.CurrentDatabase

Set collection = db.AllDocuments

Set doc= collection.GetFirstDocument

Set stream = session.CreateStream 





For x = 1 To 3 ' dev test on the first 3 emails

	Set uidoc = ws.EditDocument(False,doc)

	ws.ViewRefresh

	

REM Simulate CRTL+SHIFT+S for SaveAs prompt in UI for EML export

	

	keybd_event 17,0,0,0 ' CRTL

	keybd_event 16,0,0,0 ' SHIFT

	keybd_event 83,0,0,0 ' S

	keybd_event 17,0,2,0 ' CRTL

	keybd_event 16,0,2,0 ' SHIFT

	keybd_event 83,0,2,0 ' S

	

	keybd_event 13,0,0,0 ' ENTER

	keybd_event 13,0,2,0 ' 

	

	Set doc= collection.GetNextDocument(doc)

Next

End Sub

Right now this opens three emails in their own views. And on the last email I get the save as box but the ENTER doesn’t appear to fire.

Subject: update?

Any help or thoughts from the forum?