Through the Looking Glass: Start an application and load its data file

Through the Looking Glass: Start an application and load its data file
in one step

Ed shows how to use FILER.INI to activate a built-in, undocumented autoload
feature of the HP 200LX that lets you highlight a file in Filer and press
(ENTER) to start the corresponding application, with the file loaded.

Apple Macintosh users sometimes boast about the fact that they can click
on a document file folder and open it automatically in the appropriate
application. A comparable feature, "Associate," is found in the Windows
File Manager. Users of the HP 200LX might be interested and surprised to
know that a similar feature is built in to HP's new Palmtop PC.

This undocumented autoload feature of the HP 200LX lets you highlight
an MS-DOS application's data file in FILER and then press (ENTER) to launch
the DOS application with the data file loaded. The key to accessing this
feature on the 200LX is the creation of the FILER.INI file.

This feature may sound familiar to users of the programs 95Buddy , 100Buddy
, and now Buddy 2.0 for the 100LX & 200LX (see product description,
page 12). These excellent shareware programs added this feature to the
HP 95LX, 100LX and 200LX. (Editor's Note: As of this writing, the 200Buddy
file launcher feature overrides this undocumented 200LX feature. However,
Buddy users can turn off Buddy by pressing (CTRL)-(-) and turn it back
on by pressing (CTRL)-(+). The two launchers are somewhat complementary
as Buddy is optimized for built-in applications and FILER.INI for DOS applications.)

The 200LX feature is undocumented, meaning that it's a little
bonus added to the 200LX, but unsupported by HP. You won't find any reference
to the feature or the FILER.INI file in the HP 200LX User's Guide. This
article will attempt to show you how to set up the FILER.INI file and use
this feature. The article is based on our experience with this feature
to date. We hope it will get you started using this feature, but make no
claim as to the completeness of the information presented. The fact that
this feature is "undocumented" means that HP's Technical Support hotline
doesn't support this feature and will, most likely, not be able to give
you any help with it. It also means that the feature may be dropped from
future ROM software revisions of the 200LX or subsequent versions of the
HP Palmtop. We sincerely hope that this doesn't happen. The FILER.INI feature
cannot be transferred to another HP Palmtop.

Testing the autoload feature and creating FILER.INI

Enough disclaimers. Let's get a feel for what this autoload feature
can do. To access it we first have to create the FILER.INI file. We'll
start with a simple test case using one of the DOS applications built into
the HP 200LX.

ICN200LX.EXE, an icon viewer and editor, is found in the D:\BIN
directory. It is a program that lets you view, edit, or create icons to
be used in Application Manager. You can start the program from Filer by
highlighting ICN200LX.EXE and pressing (ENTER). You get a screen that looks
like this:

The autoload feature is built into the 200LX. It is activated
by instructions in the FILER.INI file. To set the Icon program up to auto-load
.ICN files from Filer, we have to create a FILER.INI file that contains
the appropriate instructions.

Start MEMO and type in the following two lines:

[Launcher]

ICN=D:\BIN\ICN200LX.EXE %

The first line, [Launcher], must be included, it must be spelled
as shown and be enclosed in square brackets. Upper or lower case letters
may be used.

The second line tells the 200LX which data files will be associated
with which application. The autoload feature reads the line and knows that
whenever a file with a .ICN extension is highlighted in Filer and ENTER
is pressed, the autoload feature will start the ICN200LX program and load
the highlighted .ICN file into it.

The ICN above refers to the three-letter file extension for icon
data files. The equal sign tells the feature to "associate files with this
extension to the following." The path name and MS-DOS program name of the
associated application follow. FILER.INI requires the complete path and
filename of the associated file. It won't be able to find "ICN200LX", even
if the PATH statement in your AUTOEXEC.BAT file contains "D:\BIN". You
also have to include the .EXE or .COM extension in the name.

The last character on the line is a percent sign. It is the code that
stands for the full name of the data file that will be loaded into the
ICN200LX.EXE program. Be sure to put a space in front of the percent sign.

After you've entered these two lines in Memo, press (MENU) File Save
and key in the name C:\_DAT\FILER.INI. (FILER.INI must be in the C:\_DAT
directory.) Make sure that the ASCII check box in MEMO has a check mark
in it.

TEST AUTOLOAD FEATURE

Switch back to Filer, press (F5) (Goto), key in D:\BIN and press
(ENTER). In the D:\BIN directory you'll find several icon files that end
with the extension .ICN. Highlight one of the filenames and press (ENTER).
Almost immediately the ICN200LX.EXE program will start, displaying the
icon file you highlighted. Press Quit to quit ICN200LX- EXE, highlight
another ICN file and press (ENTER) to view that icon. You're up and running!

What happened?

The HP 100 and 200LX are set up to run program files from Filer.
For example, you highlight a file with a .EXE, .COM, or .BAT extension
and press (ENTER) and the program runs. Ordinarily, if you were to highlight
a data file like one of the .ICN files and press (ENTER) you'd get the
error message:

"Cannot run file: file extension must be .BAT, .COM or .EXE."

With FILER.INI in the loop, the error message is by-passed, the
associated .COM or .EXE file is run instead, and the highlighted data file
is loaded into the .COM or .EXE application.

Limitations to using FILER.INI and workarounds

There are two limitations to the use of this built-in autoload
feature. The first is that it doesn't work as is with the built-in applications.
That is, you can't create an entry in the FILER.INI file to launch a built-in
application by highlighting its data file. We'll talk about that later
and suggest a workaround.

The second limitation is related to DOS batch files. The 200LX
lets you highlight a .BAT, .COM, or .EXE file and press (ENTER) to launch
it. However, you sometimes need to load a .BAT file into a text editor
to view or modify it. You cannot use the FILER.INI approach described above
to load DOS Batch files into a text editor to edit them. If you try the
above approach with batch files, you'll lock up your 200LX.

Workaround: Using FILER.INI to view, edit, or launch batch files

It would be nice to be able to highlight a batch file and have
the options to either view it, edit it, or launch it. You can view a batch
file from FILER by highlighting it and pressing (F8) (View). You can run
it by pressing (ENTER). There is no easy edit option.

Fortunately, there is at least one way to get around the FILER.INI
batch file limitation and create such a system. To understand this workaround,
lets first look at a way to use FILER.INI to quickly go to the DOS prompt.

1. Load FILER.INI into MEMO and add the following line.

CMD=D:\DOS\COMMAND.COM

Save the modified FILER.INI file and return to Filer.

2. Press (CTRL)-(123) to go to DOS. At the DOS prompt type REM > C:\0.CMD
and press (ENTER). This creates a file, called 0.CMD. The file is empty
and takes up no disk space.

3. Type exit and press (ENTER) to return to Filer. You should see the 0.CMD
filename in the C:\ directory listing.

4. Highlight 0.CDM and press (ENTER) and the DOS command prompt is displayed.

The line you've just added to FILER.INI tells the autoload feature to run
COMMAND.COM, the DOS command interpreter. This causes you to "go to DOS."
If you want, you can copy the 0.CMD file to other directories on your disk
so that this shortcut to DOS will be available in more than one place.

Running batch files from FILER.INI

The fact that you can launch a copy of COMMAND.COM using FILER
.INI makes it possible to run a batch file from FILER.INI. The general
form of the line added to FILER.INI in this workaround looks like this.

EXT=D:\DOS\COMMAND.COM /C C:\assoc.bat %

EXT stands for the file extension you wish to associate with COMMAND.COM
(i.e., the extension of the file you wish to highlight and press (ENTER)
in order to run the batch file).

assoc.bat stands for the batch file you wish to associate with
a the given "EXT" extension.

As an example, try the following.

1. Use Memo to create the following batch file. Save this file as C:\TEST.BAT:

@echo off

REM Test.bat

echo Hello, I'm the %0 program

echo The "data file" I'm associated with is %1

echo.

type %0

pause

2. In Memo create another file that contains some text, for example: "This
is the SAMPLE.TST file" (omit quotes). Save this file as C:\SAMPLE.TST.

3. Use Memo to add the following line to the FILER.INI file.

TST=D:\DOS\COMMAND.COM /C C:\test.bat %

Save the FILER.INI file.

4. Go to Filer, highlight SAMPLE.TST and press (ENTER). You should see
the following.

Hello, I'm the c:\test.bat program

The "data file" I'm associated with is C:\sample.tst

@echo off

echo Hello, I'm the %0 program

echo The "data file" I'm associated with is %1

echo.

type %0

pause

Press any key to continue . . .

What happened was this: FILER.INI detected the "TST" extension
and responded by running COMMAND .COM which, in turn, ran TEST.BAT. It's
possible to run a batch file from FILER.INI using this method.

Viewing, editing, or running batch files: you choose

Remember our goal: To create a system whereby we can view, run,
or edit a highlighted batch file. Let's see if we can get FILER.INI to
let us highlight a batch file, press (ENTER) and be asked whether we want
to Run it, View it, or Edit it.

One way to do this uses ECHONL.COM , a program discussed in Vol.3,
No.4, Pg.53 of The HP Palmtop Paper. That issue gives detailed instructions
on how to create ECHONL.COM using Memo and the built-in Debug feature of
the HP Palmtops. The batch file that follows uses an ECHONL command.

CREATE VIEW/EDIT/RUN BATCH FILE

First we'll create a batch file to give us the Run/View/Edit option.
In Memo, key in the following batch file. Don't type the "//" delimiters or the comments to the right of them.

@echo off

if exist $.* del $.* // Delete the

// intermediate files

if not "%2"=="" goto %2 // If the second

// parameter is not

// blank go to the

// the appropriate

// label below.

set Fn=%1 // Set environment

// variable

echo Options for %Fn% // Put the prompt

// on the screen

echo R)un, V)iew, E)dit?

Echonl %0 %Fn% > $ // Put CHOICE and

// Filename in the

// $ file

copy $+con $.bat > nul // Append input to

// $ and create

// $.BAT

$ // Run $.BAT file

:V // View commands

VU %Fn%

goto end

:E // Edit commands

ted3 %Fn%

goto end

:R // Run command

%Fn% %0

:End

[When you run this batch file, you be asked to press Run, View,
or Edit. Be sure to press (F6) and (ENTER) after making your selection.]

The VU command in the VU %FN% line refers two VU.COM , a file
viewer on the last two Subscriber PowerDisks. You can substitute another
file viewer or just use the command TYPE %Fn% | d:\dos\more in place of
VU %Fn%.

The ted3 command in ted3 %Fn% refers to TED3.COM , a text editor. You
can substitute another text editor such as VDE.EXE or Qedit.EXE .

Save the above batch file as C:\CHOICE.BAT .

MODIFY FILER.INI

Use MEMO to add the following line to FILER.INI:

bat=d:\dos\command.com /c c:\choice.bat %

Save the FILER.INI file and return to Filer. Point at TEST.BAT
and press (ENTER). You'll see the message,

Choices for C:\test.bat

R)un, V)iew, E)dit?

Press V (F6) (ENTER) to view contents of TEST.BAT.

Press E (F6) (ENTER) to open TEST.BAT in the text editor you set
up in

CHOICE.BAT.

Press R (F6) (ENTER) to run TEST.BAT. You should see a message
something like this:

Options for C:\test.bat

R)un, V)iew, E)dit?r^Z

Hello, I'm the C:\test.bat program

The "data file" I'm associated with is c:\choice.bat

@echo off

echo Hello, I'm the %0 program

echo The "data file" I'm associated with is %1

echo.

type %0

pause

Press any key to continue . . .

List/extract/view an archive file

This example shows you how to use FILER.INI to set up a system
that will let you highlight an archived file, press (ENTER) and be given
the options to list the files in the archive, extract one or several files
from the archive, or view the contents of one of the files in the archive.

The example below assumes that you are looking at an archive file
created by LHA.EXE . LHA is a file compression program that lets you bundle
a group of files together in a compressed file that ends with the extension
.LZH.

Suppose you have a group of documentation files that take up a
lot of space on a disk and are referred to only on rare occasions. To conserve
space, use LHA to archive them into a single compressed file called ALLDOCS.LZH.

You'd like to be able to access the documentation files without having
to uncompress them all. You might want to get a listing of the files in
ALLDOCS.LZH. You might want to view the contents of one of the files without
extracting it. You might want to extract one or several documentation files
from the archive. Below is LZH_OPT.BAT, a batch file that will give you
these options.

@echo off

REM LZH_OPT.BAT

if exist $.* del $.*

if not "%2"=="" goto %2

set Fn=%1

echo Options for %fn%

echo L)ist, V)iew, E)xtract ?

echonl %0 %fn% > $

copy $+con $.bat

$

:L

LHA L %fn% | more

echo.

pause

goto end

:V

lha p %Fn% %3

goto end

:: if you have VU.COM or another file

:: viewer substitute the following

:: 4 lines in place of the last two

:: lha e %Fn% %3

:: vu %3

:: del %3

:: goto end

:E

lha x %Fn% %3

:end

Add the following line to FILER.INI.

lzh=d:\dos\command.com /c c:\lzh-opt.bat %

The next time you point at an LZH compressed file and press (ENTER),
you'll see a prompt that asks you to press List, View, or Extract, followed
by (F6) and (ENTER). You can use List first to see what files are in the
LZH file. To view a particular file in the archive, type V, followed by
the file name, followed by (F6) (ENTER). To edit a particular file, type
E, filename, (F6) (ENTER).

You'll have to wait a couple of seconds before the LHA program starts
to work. (You'll wait forever if you forget to press (CTRL)-(Z) or (F6)
and then (ENTER)).

Compiled batch files: another workaround

The second way to get around the "no batch file" limitation of
FILER.INI is to convert the batch file into a .COM or .EXE file with a
batch file compiler. There are several such batch-file-compilers on the
shareware market. BATLITE.LZH is an example of one such program. BATLITE
.LZH contains the program used to compile the batch file and a documentation
file describing how to use it. Once you've converted a batch file to a
.COM file, you may use the .COM file in place of the "D:\DOS\ COMMAND.COM
/C" ploy described earlier.

Using FILER.INI with the built-in applications

The autoload/FILER.INI feature was designed to handle DOS programs
on the HP 200LX. By itself, it does not work with the built-in, System
Manager compliant programs such as Memo, Phone, Appointment Book, 1-2-3,
etc. However, with a little help from a couple of useful add-in programs,
FILER.INI's usefulness can be extended to System Manager applications as
well.

KEYSTUFF AND FILER.INI

The first of these add-ins is KS.COM, a small program that "stuffs"
a character or series of characters into the keyboard buffer, causing the
Palmtop to execute them. Functionally, this program lets you enter predetermined
strings of characters or commands into the Palmtop, just like a macro.

We needed to modify the original keystuff program to make it work with
FILER.INI. The modified version, KSX.COM along with the original KS.COM
are found in KS.ZIP , on this issue's HP Palmtop Paper ON DISK and on CompuServe.
The file also includes a description of how to use keystuff. For example,
when KSX.COM is available, you can put the following command in the FILER.INI
file:

gdb=c:\ksx.com @c@$@9%/

This command lets you highlight a .GDB database file and press
(ENTER) to start the built-in Database application and automatically load
the database file. Similar commands may be created for files that have
the extensions, .NDB, .EQN (for HP Calc/Solver), and even .WK1. We've included
examples of several such commands in the KS.ZIP mentioned above.

If you don't have The Palmtop Paper On Disk, there's another way
to get FILER.INI to work with System Manager programs. This solution involves
a program called Pushkeys, built into the HP 100/200LX. PUSHKEYS.COM is
a built-in program that stuffs keystrokes and commands into the keyboard
buffer, causing them to be automatically executed in much the same way
as a macro. Pushkeys is a Terminate and Stay Resident program that uses
.MAC macro files created by the built-in macro application for its input.

The solution involves several steps. We'll walk through them and leave
it up to you to decide if all the additional keystrokes are worth the extra
effort.

2. At the DOS prompt, key in the command d:\bin\pushkeys /i and press (ENTER).
You should see the message "Pushkeys installed." Restart System Manager
by typing 200 and pressing (ENTER).

3. Create a .MAC macro file to use with the Pushkeys program. This file
will contain the keys and commands you wish to execute with Pushkeys. To
create this file, follow these steps:

A. Press the Filer key and go to the C:\_DAT directory and highlight the
SETUP.ENV file. Press (F2) and copy the SETUP.ENV file to SETUPENV.BAK.
This step saves the current macros in a backup file and ensures that what
we're about to do can be undone.

B. Press (CTRL)-(&...) to start the System Macro application. Then
press (F7) to clear out ALL the macro definitions that you may have.

C. Point at the Fn+F1 field and press (ENTER). In the Description field
type GDB; in the Contents field, type {Database}{Menu}fo{Tab}. (There is
a shortcut to entering a key name bracketed in French braces. Press (F6)
and then the key. For example, to enter {Database} in the Macro Contents
field, press (F6) and then press (CTRL)-(PHONE).) When you're finished
entering the macro code, press (F10) (OK).

D. Press (MENU) File Save As and save the file with the name GDB.MAC

4. Add the following line to FILER.INI and save the file.

gdb=d:\bin\pushkeys.com c:\_dat\gdb.mac

Start Filer and point at any file that has an extension of .GDB
and press (ENTER). The database application will start, the Open File screen
will be displayed and the highlight bar will be resting in the File selection
portion of the screen. Select the .GDB database file to load and press
(ENTER).

This approach has a limitation: It only takes you to the Database
File selection screen. You have to select the .GDB file from there. This
is because Pushkeys doesn't recognize "%" as a valid command line parameter,
nor does it have any meaning in a System Macro.

Pushing FILER.INI to the limit

If you're interested in extending further the capabilities of
FILER.INI, check out another add-in program called PNS200 (Point-N-Shoot).

The PNS200.EXE (and its data file) will let you create menus similar
to the menus we created above for .BAT and .LZH files. The advantage of
using PSN200 is that you don't have to create separate batch files for
each application. PNS200 will also run KS.COM so that you can start System
Manager applications and automatically load the data file pointed at. The
disadvantage is that the coding in the PNS200.INI file is very cryptic
and will require some experimentation to gain mastery of the program.

Why keep this neat stuff secret?

As was mentioned in the beginning of this article, FILER.INI is
a "undocumented" bonus program in the HP 200LX. Such undocumented features
are not unusual in HP products and one can only speculate as to why they
are left on the Palmtop. Perhaps these programs were developed for HP "in-house"
use. HP may have felt that the programs were of some use to the general
population, but limited in their appeal or required a little too much technical
savvy to use. They may have left them on the Palmtop for the more adventurous
and self-sufficient users to play with. They may have decided not to mention
or document them so they wouldn't confuse the majority of users or spend
a lot of money technically supporting little-used applications.

It's fortunate for us that they left FILER.INI on the HP 200LX
and PUSHKEYS.COM on both the 100 and 200LX. They are very useful programs
that let us, with a little bit of work, expand the capabilities of HP's
fine Palmtop PCs. It's fun to discover that you've got some pretty good
prizes in HP's "Cracker-Jack" computer.