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

Programmer's Corner: DOSKEY -- a Built-in Power Tool in the HP 100/200

Programmer's Corner: DOSKEY -- a Built-in Power Tool in the HP 100/200LX

Ed shows how to save keystrokes and create macros with DOSKEY on the HP 100/200LX, and introduces TODDY, a feature rich big brother to DOSKEY that runs on the HP 95LX and HP 100/200LX.

By Ed Keefe

In this article, we'll examine some of the features of the built-in 100/200LX DOSKEY program and show how it can be used. We'll see how DOSKEY can save keystrokes and how you can use it to create macros that take the place of some of your batch files. Finally, we'll mention TODDY , a freeware program similar to DOSKEY that runs on the HP 95LX as well as the 100/200LX. (TODDY is found on The 94-95 HP Palmtop Paper Subscriber PowerDisk.)

DOSKEY: What It Is

DOSKEY is a Terminate and Stay Resident (TSR) program that lets you recall, edit and run DOS commands, and create and run macros. DOSKEY is found in the D:\DOS directory of the HP 100/200LX. The program itself is in ROM, so it takes up no additional disk space. When it's loaded into RAM, it uses anywhere from 3 to 6K bytes of memory.

DOSKEY is almost an undocumented program in the HP Palmtop User's Guides. It gets a mere two line mention on page 7-29 of the HP 100LX User's Guide, and another brief mention on page 25-7 of the 200LX User's Guide. An MS-DOS User's Guide will give you more information, but for those who don't have a DOS reference at hand, we've included a synopsis of the DOSKEY commands in the sidebar on page 46.

A Power Tool for MS-DOS Users

DOSKEY could be called a DOS user's "power tool." It keeps a "command history" of the MS-DOS commands you have used in the past. DOSKEY then lets you recall and execute these previously issued DOS commands. On the HP Palmtops this command history is maintained from one DOS session to the next, as long as you don't reboot your computer.

An example will help clarify this. With DOSKEY installed (see Installation and Getting Help), let's say you're at the DOS prompt with the error message "Path not found." You just used the DOS command DIR A:\GAME\BRIDGE to list the files in your BRIDGE directory, but the directory is on your C drive not A. Instead of re-typing the whole line, as you would normally have to do in DOS, press (<UpArrow>) (CTRL)-(<LeftArrow>) C and (ENTER). This recalls the command, moves the cursor back to A, replaces A with C and executes the new command, DIR C:\GAMES\BRIDGE. This command editing feature, alone, can save you countless keystrokes.

DOSKEY lets you use the up-arrow, page-up, page-down or downarrow keys to recall and cycle through the list of previous DOS commands. You can then use the right-arrow, left-arrow, Home, and End keys to move to any part of the command on the command line and make corrections or changes. Also, the insert, delete and backspace keys work like they do in most text editors. The Ctrl-right and Ctrl-left arrow keys move the cursor to the beginning of the next or previous word. The Esc key deletes the current command without producing a "\" sign on the screen. (For a list of DOSKEY's commands, see the DOSKEY Editing Commands sidebar, this issue.)

 Installation and Getting Help

If you just want to play with the program to see what it's like, press (&...) (MENU) Application Terminate all... OK, then type the command:

d:\dos\doskey /insert /bufsize=1024

and press (ENTER). INSERT specifies that any new text you type in a DOS command line is inserted in between old text, pushing the old text to the right and not erasing it. If you would rather copy over old text, eliminate this command. BUFSIZE= 1024 gives you a larger buffer to remember more previous DOS commands.

If you decide to use DOSKEY as a permanent part of your MS-DOS repertoire, put the above command in your AUTOEXEC.BAT file, and reboot by pressing (CTRL)-(ALT)-(DEL).

Since DOSKEY cannot unload itself from memory, it's a good idea to install it prior to any other TSRs which can unload themselves. If you load DOSKEY after such programs as REMKEY or MAGNIFY, they won't be able to unload themselves from memory.

If you're not familiar with DOSKEY, you can issue the command d:\dos\doskey /? to get the help screen (if DOSKEY is already loaded, just enter doskey /?). Here's the first part of the help screen.

DOSKEY [/REINSTALL] [/BUFSIZE=size]

[/MACROS] [/HISTORY]

[/INSERT | /OVERSTRIKE] [macroname=[text]]

/REINSTALL --- Installs a new copy of DOSKEY

/BUFSIZE=size --- Sets size of command history buffer.

/MACROS --- Displays all DOSKEY macros.

/HISTORY --- Displays all commands stored in memory.

/INSERT --- Specifies that new text you type is inserted in old text.

/OVERSTRIKE --- Specifies that new text overwrites old text.

Note that the BUFSIZE, INSERT, and other DOSKEY commands are briefly explained in this screen.

Using DOSKEY

Once DOSKEY is loaded, you can issue the commands doskey /m to list the command history, or doskey /h to list DOSKEY macros you've created.

History List:

This display lists the past DOS commands you've entered since the last reboot of your Palmtop. If you have a long history list, or want to recall any of the commands, press (F7) instead of DOSKEY /H option. The F7 key displays up to 23 previous commands, numbered as shown below, and prompts you to press any key to see any additional previous commands.

DOSKEY's Numbered History List: Graphic

 The line numbers let you recall the DOS commands in the history list. For example, say you've just pressed (F7) and want to recall the 14th command in the list. Press (F9) to get the "Line number:" prompt, and type 14 and press (ENTER). The command will appear at the DOS prompt where you can edit it or press (ENTER) to execute it.

When you examine the list of your previous commands, you'll undoubtedly notice that DOSKEY is not smart enough to eliminate redundant commands or bad commands. It keeps a record of the good, the bad, and the ugly.

To clear the entire command history from memory, just press (ALT)-(F7). All those old commands "are history"!

If you want to search for a particular command, type the first couple of letters in the command and press (F8) repeatedly until the command appears.

Multiple Commands:

DOSKEY allows you to put several commands on the same line. To end one command and start another, press (CTRL)-(T) between the commands. When you press (ENTER), the commands will be executed one after the other. For example, look at the command line listed below. (The line below is a single command line, wrapped due to formatting constraints.)

echo off ^T cd\ ^T dir /A:A-D /B /S /l /o:n > TMP ^t cls ^t type TMP ^T del TMP ^T echo on

This single command line does the following:

echo off -- turns Echo Off.

cd\ -- changes to the root directory.

dir /A:A-D /B /S /l /o:n > TMP -- creates a list of file names that are not directories and whose archive bit is set and sends the list to a file called TMP. cls -- clears the screen. type TMP -- views the TMP file using the TYPE program. del TMP -- deletes the TMP file when TYPE is finished. echo on -- sets Echo ON.

Each of the commands is separated with a ^T, produced by pressing (CTRL)-(T).

DOSKEY Macros

You can use the DOSKEY program to create macros that replay one or more DOS key commands. This is particularly useful for DOS commands you use over and over again.

A simple way to create a DOSKEY macro is to recall the command from the history list so that it appears on the DOS command line. Then press (Fn)-(<LeftArrow>) (Home) and add the phrase DOSKEY macname= at the beginning of the line, where "macname" is the macro name you've chosen. Then press (ENTER).

For example, one of the DOS commands that I use (which coincidentally uses DOSKEY itself) is:

DOSKEY /M > c:\macs ^T ted2 c:\macs

When I execute this command from the DOS prompt, it does the following:

DOSKEY /M -- creates a list of all my DOSKEY macros.

> c:\macs -- sends the list to a file and saves it as MACS in the root directory of the C: drive.

^T -- separates each DOS command.

ted2 c:\macs -- opens the "tiny editor" (TED2.COM ) text editor with the MACS file loaded.

To create the DOSKEY macro version of this command, I recalled the command and converted it to the following (single line):

DOSKEY VM=doskey /M $G c:\macs $T ted2 c:\macs

VM, the name I've given the DOSKEY macro, stands for ViewMacs. DOSKEY uses a slightly different command language than MS-DOS. So, for example, I had to change the ">" symbol in the batch file to $G and the ^T symbol to $T to conform with the DOSKEY coding convention shown in the side bar.

Why bother creating this DOSKEY macro? Well, there are a couple of good reasons: first, I no longer have to search for the command in my history list. I can simply type VM, at the DOS prompt and the command runs immediately. The second, and more important benefit is that once I have created a macro, I can save it in a batch file along with all my other macros. This fact allows me to re-use a standard set of macros wherever I need.

Make DOSKEY Macros Reloadable

If you re-boot the Palmtop, you will lose all the DOSKEY macros that you have created. However, you can save your DOSKEY macros by using DOSKEY to create a DOS batch file that when run, will reload your DOSKEY macros. I use the following DOSKEY macro to create the "reloading" batch file called DK.BAT (single line):

DOSKEY SM=doskey /M $G c:\dk.bat $t ted2 c:\dk.bat

DOSKEY /M creates a list of the DOSKEY macros; $G, like in the "VM" macro above, saves the list in a file named C:\DK.BAT; $T separates the next command; ted2 c:\dk.bat starts the Tiny Editor and loads the DK .BAT file into the text editor. After this DOSKEY macro is run, DK.BAT would contain a list looking something like this:

SM=doskey /M $gc:\dk.bat $t ted2 c:\dk.bat Q=exit$t100 VM=doskey /M $g c:\macs $t ted2 c:\macs WHEREIS=dir \$1 /s/b

I set the DOSKEY macro up to automatically load DK.BAT into the editor because the word "DOSKEY" has to be added to each line in the file. Then when the batch file is run, each line will be recognized by DOSKEY as a command to create a DOSKEY macro. This reloads the macros into the resident copy of DOSKEY. I add @ECHO OFF as the first line in the batch file so the batch file commands aren't displayed on the screen as they execute.

You can automatically start DOSKEY by putting the command DOSKEY in the AUTOEXEC.BAT file. You can then automatically reload your DOSKEY macros by adding the command: CALL C:\DK.BAT immediately after the DOSKEY command in the AUTOEXEC.BAT file.

In addition to the macros captured in the DK.BAT file, you can add other DOSKEY macros, or edit existing ones, using any text editor. It is possible to capture the command history list by replacing the DOSKEY /M in the above macro with DOSKEY /H. However, it's of little practical value since there's no way to reload a command history list from a batch file or any other file.

Convert batch files to DOSKEY macros

You can convert many of your favorite batch files into DOSKEY macros and add them to the DK.BAT file. For example, one of my most frequently used batch files is ZB.BAT (ZB stands for ZIP Backup). The batch file first uses ZOOM to switch to a more readable screen. It then unloads REMKEY freeing up the serial port so that ZIP can be used to transfer backup files to the desktop PC. The batch file looks like this:

@echo off

C: ;log onto C: drive

CD\ ;go to the root directory

ZOOM C4 ;Zoom to 40 column screen

REMKEY /U ;unload REMKEY from memory

ZIP \V ;run ZIP.COM in server mode

REMKEY ;reload REMKEY

100 ;return to System Manager.

The corresponding single-line DOSKEY macro is:

DOSKEY ZB=echo off $T CLS $T C: $T CD\ $T ZOOM C4 $T REMKEY /U $T ZIP \V $T REMKEY $T echo on $T 100

(All of the above appears on one line. The spaces on either side of the $T.)

The macro version of ZB runs slightly faster than the batch file version. To use either the batch file or the macro, I exit System Manager by pressing (&...) (MENU) Applications Terminate all... OK. I then key in ZB and press (ENTER).

You can use almost any of the normal batch file commands in a DOSKEY macro, except the GOTO, the : (label), and the CALL commands. DOSKEY does not support nesting of macros or the calling of one macro by another. However, you can run a batch file with a macro. Even though you can make a DOSKEY macro run a batch file, you can not make a batch file command run a DOSKEY macro.

DOSKEY Macros Can Save Disk Space

One advantage to using DOSKEY macros in place of batch files is that they take up less disk space. Files are stored on a disk in discreet units called "clusters." No matter how small a batch file is, it uses up one cluster. So if, for example, you have ten small batch files with an average size of 100 bytes each, you still need 5,120 bytes of disk space on the C drive and as much as 80K on a flashdisk to store the ten files. When you combine the batch files in the DK .BAT file, you wind up with a single batch file of approximately 1,000 bytes, which means that you've saved 4K on the C drive and up to 79K of disk space on a flash card.

TODDY : a More Powerful Version of DOSKEY for the HP 95LX and HP 100/200LX

DOSKEY is new to MS-DOS version 5.0. However, command history/ keyboard enhancing programs have been around ever since MS-DOS 2.0. Early MS-DOS users will recall such commercial programs as SuperKey and Prokey, and some HP 95LX owners have used a shareware program called UMA (Useful Macros) . A freeware program called STACK is also available for the HP 95LX and 100LX. However, in my opinion the best freeware program in this genre is TODDY, version 6.0. (Available in the HP forum on CIS, and on the 1994 Subscribers PowerDisk.)

TODDY is a superset of the DOSKEY program. It uses many of the same coding conventions as DOSKEY. For example, Ctrl-T and $T serve as command separators in command-lines and macros. TODDY also supports both a command history and a macro capability. But, where DOSKEY has only six command line options, TODDY has ninety!

TODDY will let you nest and chain macros where DOSKEY won't. TODDY also has a window in mid-screen that contains a scrollable list of previously used commands. You don't have to search blindly for the command you want to use. (On the 95LX, you may have to shift the screen to see the feature.) TODDY also allows you to assign macros to non-printable keys, such as F1, ALT-Z, etc.. DOSKEY does not let you do this. This eliminates the need to use NANSI.SYS to reassign the function keys, saving Palmtop users 9K bytes of system RAM and 9K bytes of disk space.

TODDY 6.12 , the newest version, adds a new feature that works similarly to the DOSKEY macro described earlier that is used to create DK.BAT. A TODDY macro can use a command line like:

Toddy /MWmacs $T VDE macs

This line writes a list of TODDY macros to a text file named "MACS" and opens MACS up in the VDE text editor. (The version of TODDY found on the PowerDisk 94 does not support this feature.)

If you've ever used DOSKEY and given up on it because of its limitations, you owe it to yourself to try TODDY. It's an amazing program and the price is right -- it's freeware!

DOSKEY Editing Commands

DOSKEY Macro Codes and Examples

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