Sub btnPrint_Action
Dim js As Shell
Dim params As List
params.Initialize
'save the text to a file. New lines characters are replaced with <br/>.
File.WriteString(File.DirApp, "temp.txt", txtArea.Text.Replace(CRLF, "<br/>" & CRLF))
If printer.Text <> "" Then params.Add("printername=" & printer.Text)
params.Add("file=temp.txt")
js.Initialize("js", "printhtml.exe", params)
js.WorkingDirectory = File.DirApp
js.Run(-1) 'run with no timeout
btnPrint.Enabled = False
End Sub
Sub js_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log("Success=" & Success & ", StdOut=" & StdOut & ", StdErr=" & StdErr)
btnPrint.Enabled = True
End Sub