Lotus Script to be excute only after an exe program ended...
Posted on 2004-03-23
HI I am having much headach with this, I've very new to lotus script . I have a VB program which create files inside a temp folder inside the c:\ and what the lotus script needs to do is. Create an agent that call my exe program then after the program ends get the files that the exe created inside the temp folder and attach it to the new memo that the user have already created.
I have tried the Yeild function and apparently the win3.1 API doesn't support the w2k and its a big mess here. Please help.
Below is my code. What its doing now is it doesn't wait untill the shell program ends, the message box pops up imideately when the program is called and I don't want it that way. Msg box is my temporarily solution to halt the script.
Dim session As New NotesSession
Dim curdb As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim chk As Boolean
Dim result As Integer
result = Shell ( "C:\test.exe", 1)
Msgbox "Please click on OK when you have selected the Documents to be Attached."
Set curdb = session.CurrentDatabase
Dim doc As New NotesDocument (curdb)
Set rtitem = doc.CreateRichTextItem( "Body" )
Dim pathName As String, fileName As String
pathName$ = "C:\Temp\"
fileName$ = Dir$(pathName$, 0)
Do While fileName$ <> ""
Set object = rtitem.EmbedObject( EMBED_ATTACHMENT, "",pathName$&fileName$ )
fileName$ = Dir$()
doc.Form = "Memo"
Call doc.save (True, True)
Call workspace.EditDocument(True, doc)