Stuffing text from Word into a VT100 terminal emulator

P

Paul Bishop

Here's a challenge for you. I need to get some complex text into a legacy
database running in a VT100 terminal emulator (please don't laugh). So I am
generating the text in Word 97 using dropdown form fields, with VBA running
in the background to conditionally alter other fields. Once done, I have a
button that copies the text to the clipboard. The user switches to the VT100
terminal emulator and pastes the text in. There are two remaining things
that I would like to do.

1) Preserve the bold and underline from the Word text. In the database,
bold is switched on and off with key strokes <crtl-6><b> and underline with
<ctrl-6><u>.
2) Also put data into other fields in the database. I could due this with a
macro in the terminal emulator but I want the data vary depending on the
contents of the Word file. So when I switch to the database, I am thinking
that I need to be able to stuff the keyboard with a sequence of keystrokes.
I realise that the solution may depend on the specifics of the VT100 terminal
emulator that I am using. The terminal emulator runs macros which are held
in files. One possibility is to have VBA write the macro to a file, switch
to the terminal emulator and then run the macro that Word has just produced.
 
J

Jezebel

Hard to suggest without knowing a little more (and sorry, I can't keep a
straight face --- then again, I've still got a couple of VT52s in the back
shed). Is it feasible to output the document to a text file, then pipe that
into your emulator app? My recollection is very hazy on this (VT100 is early
80s, as I recall), but I'm sure we had a method of using a text file in
place of the keyboard source.
 
P

Peter Jamieson

Just out of interest, what is the database system and what system/OS is it
running on?

Peter Jamieson
 
P

Paul Bishop

The database is called "Telepath". It is used by pathology departments in
the British National Health Service. I believe it runs under Mumps. The
PCs, of course, run the terminal emulators under Windows of various vintages.
 
P

Peter Jamieson

Can't really help you on that one, though I'd have thought there was some
form of bulk loader for Mumps that could do the job. ISTR getting data
/from/ a Mumps system without too much difficulty a few years ago (I didn't
touch it personally, but the NHS IT people we were working with seemed to
have the necessary tools), but maybe it was something else.

Peter Jamieson
 
P

Paul Bishop

I'm not in a position to start meddling with Mumps. All I have is the
functionality of the terminal emulator. I will see if I can get VBA to write
a file which will act as a script for the emulator.
 
P

Paul Bishop

I think I can get the terminal emulator to do what I want by running a
script. The script is a straightforward ascii file. So I need to assemble
the script as a string in VBA, then write it to the script file. Excuse me
asing something so simple, but how do I write the string to a file? (My book
on VBA tells me how to write documents to file, but not a simple string. I am
new to VBA)
 
P

Peter Jamieson

The following code shows an example of how you can write the contents of
string S to a file, but there are doubtless better ways:

Dim s As String
Dim iFileNumber As Integer
Dim strFilePath As String
s = "some text to write"
strFilePath = "c:\mytextfiles\myfile.txt"
iFileNumber = FreeFile
' Need to open for output to create a new file
' because Put to a Binary file just overwrites
' existing data
Open strFilePath For Output As iFileNumber
Close iFileNumber
' Re-open in the mode we want
Open strFilePath For Binary As iFileNumber
Put iFileNumber, , s
Close iFileNumber

Peter Jamieson
 
P

Paul Bishop

Thanks

I tried that but it stuck an unprintable character and a "$" at the
beginning of the script. The simplest way to write the scripit is:

s = "the script that I need to run"
open "c:\ptw32\snomed.psl" for output as #1
print #1, s
close #1

It works. I mapped the spare Enter key at the right of hte number pad to
run the script. Let's see if my colleagues think it worth the effort.

Paul Bishop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top