Accuterm can also execute a vb-like script. Here is an example (I got it
from the ASENT.COM web site) that executes a WORD mail-merge process. I
added a belt-AND-suspenders solution to the timing problem: the script
outputs a text string ("DONE") at the end, which the calling basic
program waits for with an INPUT, after which it also SLEEPS.  In
retrospect, 5 seconds seems a bit extreme; but this thing has been
running for years and years, so I am unlikely to mess with it.

/Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006

SUBROUTINE ATWORDMERGE.SUB(DOCUMENT)

* THIS SUBROUTINE EXECUTES A PRESET WORD MERGE WITH A DOCUMENT USING
ACCUTERM
* 19 MARCH 2001 BC

EQUATE EM TO CHAR(25)

PRINT "Now printing document: ":DOCUMENT:"... ":

*First create our object variables
SCR =        'Dim WordApp As Object'
SCR = SCR:EM:'Dim WordDoc As Object'
SCR = SCR:EM:'Const SendToPrinter = 1'

*Make sure errors dont mess us up
SCR = SCR:EM:'On Error Resume Next'

*Start up word
SCR = SCR:EM:'Set WordApp = CreateObject("Word.Application")'

*Open our source document
SCR = SCR:EM:'Set WordDoc =
WordApp.Documents.Open(FileName:="G:\UVWORDMERGE\':DOCUMENT:'",
ReadOnly:=True)'

*Merge the document with our data file
SCR = SCR:EM:'With WordDoc.MailMerge'
SCR = SCR:EM:'    .Destination = SendToPrinter'
SCR = SCR:EM:'    .SuppressBlankLines = True'
SCR = SCR:EM:'    .Execute Pause:=False'
SCR = SCR:EM:'End With'

* clean up
SCR = SCR:EM:'   WordDoc.Close savechanges:=False'
SCR = SCR:EM:'   Set WordDoc = Nothing'
SCR = SCR:EM:'   WordApp.Quit'
SCR = SCR:EM:'   Set WordApp = Nothing'

* output text string back so we'll pause until word has completed
SCR = SCR:EM:'   InitSession.Output "DONE" & Chr$(13)'

PRINT CHAR(27):CHAR(2):'P':SCR:CHAR(13):

PROMPT ""
INPUT DONE
PRINT

SLEEP 5  ;* allow word to completely shut down

RETURN
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to