Loading
Everything HP200LX: Knowledge, Products, Service

 Archives
9 years, 100's of pages of HP Palmtop Paper, jammed with tips, reviews and how-to's

Links
Most useful, up-to-date Web sites devoted to the HP 200LX

Downloads
Direct link into 1000's of pieces of Palmtop software

Tips from Our Techs

2008 Catalog
(PDF, 2.6 MB)

Contact Us/About Us

 
Weekly Palmtop Paper Newsletter
(Palmtop tips, latest happenings, and HP Palmtop Paper Store information)


 

 

Privacy Policy

Programmers Corner: LXBatch Programming, Part II

Programmers Corner: LXBatch Programming, Part II

Ed demonstrates some of the commands available in the LXBatch programming language and creates a program to enhance FILER on the HP 200LX.

By Ed Keefe

In a previous installment of the Programmer's Corner, we started to explore some of the commands built into the LXBatch language from Rob Koenis.

 In this article, we'll delve into more of these commands and create a handy utility program that will breathe new life into an undocumented feature of FILER on the HP 200LX.

 The Problem

 The undocumented feature on the HP 200LX is called "file association." It relies upon a file called "FILER.INI" which you create and save in the C:\_DAT directory. For example, suppose you create the following file in MEMO and save it as C:\_DAT\FILER.INI

 [LAUNCHER]

 TXT=A:\WRD\PE.EXE %

 Now, when you go to FILER and highlight a file with the extension .TXT and press Enter, the association feature will "launch" PalEdit (A:\WRD\PE.EXE) along with the highlighted .TXT file. The "%" sign in the association statement stands for the name of the data file. Without the FILER.INI file, you'd get an error message: "Cannot run file: file extension must be .BAT, .COM, or .EXE".

Buddy users have grown accustomed to this association feature since the days of the HP 95LX. Windows users have a similar feature on their desktop. However, the association feature in FILER, as well as in Buddy and in Windows, has a short-coming: you can hook files to only one program.

For example, you might associate an .SND file with the PLAYEX.EXE program. This would let you highlight .SND files in FILER and play them by pressing the Enter key. It won't let you associate an .SND file with an editor, viewer or another player program.

On the other hand, the MS-DOS file manager, Stereo Shell, gives you a choice of things to do with any file. You can point at a file, press Enter and get a menu that will let you either Run, View, or Edit a .BAT file. If the file is something other than a .BAT, .COM, or .EXE file, Stereo Shell modifies the choices so that you can Edit, View, or Launch a program that will use the data file. Unfortunately, Stereo Shell only works in DOS (Screen 1). You can't use Stereo Shell within System Manager.
 
 

 Screen 1: Stereo Shell works only in DOS.

 The Solution

 Here's the challenge: create a program, called CHOICE.LXB, that will make FILER act like Stereo Shell; namely, present a list of things you can do with any data file. We can omit the choices of copying, moving, or deleting files, since FILER itself performs these tasks well enough.

 For the sake of expediency, we'll show how to create a part of this program for files that have the extensions .ZIP or .LZH. A more complete version of CHOICE.LXB is available on this issue's The HP Palmtop Paper ON DISK and from either www. thaddeus.com or from the HPHAND forum on CompuServe.

 CHOICE.LXB

 The listing of the CHOICE.LXB file that will accomplish this task can be seen on the previous page. If you type this into your palmtop, don't type vhe "//" or anything after this on the line. The "//" marker signifies a remark about the command.

To see if the program will work, you need to create a FILER.INI file and save it in the C:\_DAT directory. The file should contain the following lines.

 [LAUNCHER]

 LZH=A:\BAT\LXB.EXE LXBFILE

A:\BAT\CHOICE.LXB BEGIN LZH %

 ZIP=A:\BAT\LXB.EXE LXBFILE

A:\BAT\CHOICE.LXB BEGIN ZIP %

 I keep the LXB.EXE (which is the LXBatch program) and CHOICE.LXB files in my A:\BAT directory. You may have to change "A:\BAT" to reflect the drive and directory where you keep these files.

 If you already have a FILER.INI file, you can add these new lines to the file and comment out any lines that start with LZH or ZIP by putting a ";" at the start of the old lines.

 (Don't ignore the "BEGIN" word in the above lines. It tells the LXB.EXE program where to start interpreting the CHOICE.LXB file.) Once the CHOICE.LXB program and the FILER.INI file are in place, go to FILER and highlight any file that ends with .LZH or .ZIP and press ENTER. You should see the screen that's displayed in Screen 2.

 Screen 2: This is what you'll see after highlighting an .LZH or .ZIP file and pressing enter.

 Use the ESC key or press Q or highlight the Quit option to exit the program. Try highlighting a menu item and then press ENTER to activate the selection. Try the "Pick a New File" option by pressing the "P" key to see if that works.

 If you made typing mistakes, or something in your system interferes with the CHOICE.LXB program, the program will unceremoniously terminate and dump you back in FILER without letting you know what happened. (I wish that weren't so, but such is the nature of the program.) On a few occasions while developing this program, my palmtop suffered a hard crash. I had to press CTRL-SHIFT-ON and answer N to recover. So be forewarned: back up everything in sight before you start, and proceed with caution.

Programming Considerations

 CHOICE.LXB is a prime example of non-structured programming. It's full of GOTO statements which betrays its DOS batch-file heritage. Yet it's somewhat like a Windows event-driven program. It certainly is easier to use than hacking away for hours with a C compiler and the PAL library functions.

 Rob Koenis has done a marvelous job of making it easy to create simple programs on the palmtop. With just a little pain, you can gain results that work efficiently and effectively.

More, more, more

 As mentioned above, a more complete version of the CHOICE. LXB program is available on this issue's HP Palmtop Paper ON DISK or for down-loading from www. thaddeus.com or the HPHAND forum on CompuServe.

 The archive called CHOICE.ZIP contains a much more elaborate version of a FILER.INI file with associations for almost any type of file you could have in your palmtop. The CHOICE.LXB program in the archive shows how to use the LXB commands "stuffkey" to have an LXBatch file run a built in application such as the Database or NoteTaker. It also demonstrates how to create a CHOICE.INI configuration file for CHOICE.LXB and how to use that file as well.

Be aware, however, that the added complexity of the larger version means that you'll have to spend some time getting the bigger version of CHOICE.LXB "tweaked and tuned" for your system. This is definitely not a "plug and play" operation.

Have fun with this one. I hope it proves to be a useful piece of programming.
 
 

Choice.LXB

Shareware/Freeware mentioned in this article

iPhone Life magazine


Notice about Palmtop.net
The Palmtop Network with its S.U.P.E.R. (Simply Unbeatable Palmtop Essentials Repository) software is now available under the domain name of hp200lx.net.  

 
We Buy
We buy used palmtops, working or broken: HP 200LX, HP 100LX and 1000CX.
 

Copyright 2010 Thaddeus Computing Inc