Running an MS-DOS attachment from a form

Is there a way to launch a form containing an MS-DOS batch file using LotusScript? I have a simple form which contains an action button - the idea is this button launches another read-only form which contains the batch file as an attachment. This should run then the form is closed. I’ve experimented with the Compose and EditDocument commands but they aren’t working. If launching off a separate form is not possible, is there some way to incorporate it into an action button? The batch file has to be within the form somewhere so it can be launched regardless of where the client is at the time. Thanks.

Subject: Running an MS-DOS attachment from a form

I use this function to execute a batch file stored on a form:

Sub execBatchFile(doc As NotesDocument)

Dim session As New NotesSession

Dim contents As String

Dim stream As NotesStream

Dim filename As String

Dim status As Variant



contents = doc.GetItemValue("BatchfileContents")(0)

filename = "some temp filepath"

Set stream = session.CreateStream

stream.Open(filename)

stream.Position = 0

stream.Truncate

stream.WriteText(contents)

stream.Close

status = Shell(filename)

End Sub