Question Locked

Can you write a script to have Hyperterminal auto transfer data?

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I've only used Hyperterminal a couple of times and then only to connect to a router or modem to check status or change settings.

If I have an input device connected via RS232 that sends data as if from a keyboard, can I write a script (either BAT or VB but preferably BAT) to have Hyperterminal capture and transmit this data to another program?

The device will be connected constantly, but data will only be sent once in a while.

7 replies

by tobif

1. Which Windows version are we talking about?
2. So it should not end up as standard input, but be directed to a specific program?

While playing with VBA, in some cases I used sendkeys, but it just simulates keystrokes to the system, so first you had to bring your target application to the foreground.

On a scripting level, if your target application is running and is happy to accept standard input when it's in the foreground (and you're happy about bringing the app to the foreground), then you could have something running that monitors your external device, and whenever input occurs, activates the target and then sends over the keystrokes.

If, however, you don't want the target app to interfere with your daily life, then the target app itself needs to accept input over some alternative channel, like system messages, shared file access (polling a folder on a ram disk every second, or so) or the target app itself needs to be smart enough to listen to the com port.

by seanferd

was that maybe you can directly pipe this input directly to the Other Program?

Or, if this thingumie sends data as STD IN from kb, then it could also start and run HT all by itself?

Or, if it is more complex than that, use something you can easily script, because it has a command line interface. Like PuTTY.
http://www.openssh.org/windows.html

edit: A quick link to the CLI help for PuTTY. http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter3.html#using-cmdline
But it has a GUI as well.

by tink!

Yea I probably should have included more info in the first place. lol.

- the input device is a barcode scanner. The data (barcode) it sends will be in alpha-numeric format and is sent just as if you were to type it from a keyboard.

- The reason I'm looking at Hyperterminal versus going directly into the final receiving app, is because I'm considering an old machine. [b]VERY[/b] old machine by tech standards as it is running Win98.

- Also the final receiving app is Access 2003 which will not install on the Win98 machine [i](that is, if we had an extra copy of it to install, which we don't)[/i]

- The Win98 PC does have an older version of Access. 97 I think.

- The reason I'm considering an old machine is to limit the costs of setting up this system. The receiving machine must be dedicated to the barcode scanner. Rather than buy a new PC, I'm looking at other options with what we have.

by tobif

Do I get it right:
Ancient Barcode scanner with attached PC (Win98).
This computer needs to forward information to another computer (XP?) running Access 2003.

Q1: Where's the RS232, on the old machine or somehow between the computers?
Q2: Do you need the tallying in Access to happen immediately, or is it ok to accumulate batches in the old machine? (I'm thinking of different ways to transfer data between the machines)
Q3: Do you have any driver for the bar-code scanner, so that read symbols occur as keyboard input?
Q4: Do you really need a dedicated computer for the scanner? (New scanners with USB interface have come down in price and can do amazing things, if needed)

by tink!

1) RS232 Barcode Scanner would be on the old machine.
2) Data transfer in batches throughout the day would be ok. Am looking to do things with the data once it is transmitted to Access 2003 (like alerts to another computer or emailed alerts)
3) There is no driver. The barcode scanners are just made so that the input can be sent via RS232 or USB keyboard input.
4) Yes, because of the way the data is automatically transmitted as keyboard input, the computer MUST be dedicated to the screen that would receive that data. [i](and we all know we cannot trust our users to remember to switch to the proper screen before leaving the computer - therefore - standalone dedicated computer)[/i]

Note: the barcode scanner will be new. It's a wireless scanner where the base is attached to the PC either by USB or RS232.

by tobif

I played with CLI batch commands.
The following would work on a Vista system, I don't have any W98 to test on...

1. Create a shared directory on the server and mount it to the W98 client.

Create a batch file with the following content. (Insert the location to be used into the script)

REM  2010-12-04 by TobiF
@echo off

REM Procedure to accept one line of input at a time
REM Then generate a filename, based on current date and time
REM and create such a file and write date, time and input to the file

REM If SaveLocation is empty, file will be saved in current directory
REM If SaveLocation is used, it will be prepended to generated filename
REM Typically, SaveLocation would end with a \
set SaveLocation=

:StartOver

REM Accept one line input
set /p textstring=?
if %textstring%==QUIT goto quit
REM Copy current time to variable
set CurrentTime=%date% %time%
REM Create filename from time, replace commas, colons and spaces
set filename=%CurrentTime:,=-%.txt
set filename=%filename::=-%
set filename=%filename: =_%
REM Create and write to text file
echo %CurrentTime% %textstring%    >%SaveLocation%%filename%

goto StartOver

:quit

The script will continuously iterate, until you hit ctrl-C or enter QUIT (note: in capitals)

This discussion is closed to new replies.