|Everything HP200LX: Knowledge, Products, Service|
File editing using the CTTY command
A common situation arises in my usage of my HP 200LX: while I'm at home using my PC, or at work using my office desktop computer, I want to edit a text file or source code that resides on my palmtop.
I used to transfer the file to the desktop computer, edit it, then copy it back to the palmtop when done, overwriting the original.
Well, I just re-discovered recently an old DOS command that makes this process much easier: the CTTY (Change TTY) command. This command instructs the command processor on the palmtop to begin accepting commands from, and sending output to, the specified COM port. For example, the command that I issued was:
The first thing to do is to connect your desktop computer to your palmtop using a serial cable. (If you have trouble getting the two computers to communicate with each other, see the article, Troubleshooting Modem and Data Communications Problems, in the January/February 1998 issue of The HP Palmtop Paper.)
On the desktop you have to open a terminal emulation program (or alternatively use a real terminal). From a DOS desktop system, you can use a program like ProComm Plus (PCPLUS). On a Windows system you would use the TERMINAL program supplied with the OS (operating system). Or on a Windows 95 or NT system, you have the HyperTerm program that is supplied with the OS.
Of course, you can run a DOS terminal program in a DOS box; I regularly run PCPLUS from a DOS box on my NT 4.0 system at work.
Once you've got the two computers linked up with the serial cable, and with the terminal program running on the desktop computer, you can type in the CTTY COM1 command from the DOS prompt on the palmtop. You then should be able to talk to your palmtops command line processor, command.com.
[Editors note: Before typing the CTTY COM1 command, I had to clear the serial cable route by sending a text file from the palmtop to the desktop computer. I did this by typing COPY TEXTFILE.TXT COM1 on the palmtop. The text file was displayed on the desktops screen, and I then typed the CTTY COM1 command.]
The DOS prompt (c:\) from your palmtop should show up on your desktops screen, and you can issue DIR commands, as well as many other ones.
A word of caution: only certain programs that you try to run on the palmtop will function well, or at all, over the serial port in this manner. Many graphics-like programs (like Lotus 1-2-3) access the computers video RAM directly, and hence wont work over the COM port. But simple editing can be done with the DOS EDLIN (yuk!!) program. I once used this exclusively for a week while my monitor was out for servicing, and learned to hate EDLIN.
However, it recently occurred to me that my favorite vi-clone editors ought to work over the serial port - after all, that's how they work on UNIX-based systems, from whence vi came. After a little experimenting, I found that the Elvis vi-clone will function in this mode just as expected.
You have to set the TERM environment variable to ANSI, then its set to go. You can edit your files from the desktops full size keyboard, without shuffling a file back and forth. As a bonus, you can do all the various DOS file management commands, such as COPY, RENAME, DEL, MKDIR, CD, etc., from within this mode.
Also, file filter techniques work. You can use file re-direction and piping in conjunction with DOS's SORT, and other UNIX-like filter programs such as GREP, SED and AWK . Your own programs that run on the palmtop in a command-line mode (such as a custom filter) should also work in this mode, as well.
To exit this mode of operation, issue the following command:
from the remote terminal (i.e., from the terminal program that's running on your desktop computer).
Feel free to experiment. The worst that I've seen happen is that I have to type commands on the palmtop and/or look to it for output if a program didn't work as expected. If you're not an Elvis vi user, try the popular vim editor. I tried it, and it almost worked - I got the screen display redirected, but not the keyboard commands. But the author of vim seemed willing to investigate and incorporate any modifications in a later release.
I also tried the popular and small vi-clone, Calvin . It didn't work in this mode, either, but I haven't yet contacted the author to inquire. Other text editors, if they can run over a serial port in other implementations, might well be coaxed into operating in this mode. I suggest you contact the authors.
As for me, Ill be happily editing away on my palmtop-based ASCII files, and spending less time transferring them back and forth.
Also, various file processing programs, called filters in UNIX terminology, can be used as well. For example, I can use a complicated command line like:
C:\> grep CABLE big6.txt | sort | uniq -c | sort > cable.tx
This is an extreme example. To start with, I have a file (big6.txt in this example) that has one line for every part in a system design. The above command finds all lines having the word CABLE and pipes the output into the sort command (this assumes you have obtained the DOS 5.0 sort filter, which isn't provided standard with the HP palmtop).
Once sorted, the output is piped into the uniq filter with a -c option (this assumes you have obtained this UNIX-style filter for your palmtop - my version came with the C Utilities Toolchest from MIX software - the folks who make the Power C compiler). This will count the number of duplicate lines and report the count and the line to standard output.
Finally, this output is sorted once more and the result re-directed to the file cable.txt. In this file, I have a list of all cables and their quantities, sorted by quantity.
To summarize, you can do much more than simple editing in this mode, and I wanted to point out all the possibilities.
R. Christopher Lott, P.E.,
Copyright © 2010 Thaddeus Computing Inc