Request for LotusScript Feedback/Assistance

Thankyou in advance…

I need to write a script that allows me to run a windows batch file from an external server, attach a log file and send the log file back.

Here is what I have (and its working perfectly)

I need to add whatever I need to add a script to the return email with a log file from the client installed on to it. Any suggestions would be appreciated! Thanks again!

Sub Click(Source As Button)

Dim session As New NotesSession 

Dim workspace As New NotesUIWorkspace 

Dim maildb As NotesDatabase

Dim maildoc As NotesDocument

Dim uidoc As NotesUIDocument 

Dim doc As NotesDocument

Dim item As NotesItem



Set uidoc = workspace.currentdocument

Set doc = uidoc.Document 



Set maildb = session.currentdatabase

Set maildoc = New NotesDocument ( maildb )



Msgbox "Quickly updating your SSL Box Configuration.  Click OK to Continue."

result = Shell("C:\\windows\\system32\\wscript.exe " & "\\Fume\Test\\SSLFix.vbs") 



maildoc.Form = "Memo"

maildoc.SendTo = "jeaton@xxxxx.com"

maildoc.Subject = "This Machine is Done! " 

Call maildoc.Send( False ) 	

Msgbox "All Done!  Thanks."

End Sub

Subject: RE: Request for LotusScript Feedback/Assistance

You want to add the information from the log file to the back-end email you generate at the end? You will need to create a message body using CreateRichTextItem and either attach the file (EmbedObject) or open the file, read the text, and add it to the message body using AppendText.

Subject: Request for LotusScript Feedback/Assistance

Judging from the name of the file you are shelling out to, you are running your script on a Windows machine. Problem is, on the Windows platform, Shell() does not wait for the executed program to terminate. It just returns control to LotusScript for the next statement, immediately. That’s going to make it hard to get the log file, though not impossible. You’re going to have to write a loop that uses the Sleep() function, then checks for the existence of some indicator that tells it that the program has completed – i.e., a file that isn’t created until just before the program terminates.

Subject: Request for LotusScript Feedback/Assistance

Search for WaitForSingleObject or ShellAndWait.

Plenty of posts about it.

Regards

Mov V Hansen