WORKBENCH 2.0: USING FKey  *************************  by Alan Jones  ( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 ) In his helpful Megadisc 29 review of the WB2 Commodities programs Anthony Towns was inclined to be a bit dismissive of the FKey utility as "...not that useful...simply allows the user to enter some text that will replace the function key when it's pressed." Well, there's a good deal more to it than that. Remember that Commodore, in its wisdom, had not previously assigned much importance to the ten function keys except as an opportunity for software developers to build keyboard shortcuts into their programs. Now, FKey changes that: the user can perform up to 20 different oper- ations of his or her own choosing. Although anything you can do with FKey can be done in other ways, it can save a deal of time and trouble. So, if the program is there, you've paid for it and it does what's wanted, why not use it?  SETTING IT UP ------------- FKey exists in the WB2 Extras disk, Tools/Commodities drawer (or in the A3000's hard disk.) It can be run from Workbench in the usual way, but it's a good idea to drag its icon into the WB Startup drawer so it will be on tap. In its INFORMATION window set these ToolTypes: (a) DONOTWAIT so as not to get a pesky requester at startup saying "FKey has not returned..." (where's it been, anyway?) (b) CX_POPUP=NO to hide its options window until needed.  MAKING IT WORK -------------- Once FKey is running you can view the options window at any time by pressing ALT-F1. Notice that default settings have been included in the F1 to F3 text gadgets: e.g. F2 has the entry DIR\n. Open a Shell, press F2 and the command DIR will be displayed, followed quickly by the directory of your system disk. What happens here is that FKey writes the DIR command in the Shell, and the \n suffix does a carriage return to make the command effective. Now, that is a pretty trivial example, since it's easy enough to type DIR and push the ENTER key instead. FKey's real power is its ability to perform with a keystroke those long-winded, error-prone, hard-to-remember CLI commands that some activities call for. Here, then, are a couple of time-saving operations for which I habitually use FKey.  FORMATTING FLOPPY DISKS ---------------------- It's simple to format a disk in Workbench - just go to the menu - so long as you're content to use the Old File System. But it can be worth while to format with the Fast File System (available in AmigaDOS 2.0) for the sake of the 40kB of extra space it provides. For a FFS format it's necessary to issue a SHELL command, which is easy to get wrong. So I've entered in FKey's F5 space this line: Format drive df0: name empty noicons FFS \n Now, if I get into the Shell (AutoCLI does this for me quickly) and press F5, up comes the command line with the message "Insert disk to be formatted..." and in short order I have an FFS floppy named "empty" without the trashcan. Pressing F5 again starts a second format.  UNPACKING ARCHIVES ------------------ From time to time Fred Fish distributes a program and its associated files as a big, single file, archived in the Lharc format. For example, FF565 has a directory CANDODEMOS containing the archive file CanDoDemos.lzh, along with a scriptfile called UnpackDisk that can be used to do the unpacking; and in the disk's c directory is the Lharc program itself. All very good, except that Fred's script insists on formatting a disk in df1:; but I have no df1:, and prefer to use preformatted disks anyway. I could edit the script, but it would still work only for that particular .lzh file. The solution is to enter as FKey F10: lharc -x -a -m x #?.lzh df2: So, if I use the Shell to enter the CANDODEMOS directory and then press F10 followed by ENTER, the archive will be unpacked to a disk in df2:, together with all the required directories. This will work just as well in any other directory containing an .lzh file -- so long as there's only one! (The #? wildcard characters direct the Lharc program to whatever .lzh file is present.) For this to succeed, the Lharc program needs to exist in the system c directory. If there isn't room for it, amend the FKey entry to begin :c/lharc so as to use the program as supplied on the Fish disk. Please see the footnote for more on unpacking archives.  FKey HINTS ---------- The \n characters don't always work as might be expected. Notice that the DIR\n entry has no space before the backlash. But in my FORMAT command a space is needed. And in the unpacking command, \n (with a space) will do a carriage return but doesn't start the process, so I left it out and just press ENTER instead. Experimentation is in order. Be aware that FKey takes precedence over any other programs that use the function keys; so if you're using such an application you may want to disable FKey for a while, or even quit it altogether. Call up the Commodities Exchange window and click on the DISABLE or KILL button, or use QUIT in FKey's own window. If you like, FKey's output can be viewed with the Execute Command menu item in Workbench instead of the Shell. But you may run into trouble if a second command is attempted. Try it and see!  CONCLUSION ---------- With a bit of imagination, then, all sorts of useful things can be done with FKey. To my mind it's one of the most helpful of the WB2 Commodities.  --------------------------  Footnote -------- Quite recently Fred Fish has taken to using the LhA archiver, whose output files have the suffix .lha (example: KCommodity.lha on FF673.) One could use an F key just to handle these. But, as LhA is compatible with .lzh files, an option is to enter this in FKey: LhA -x -a -m x #?.(lha|lzh) df2: so as to unpack either kind of archive with LhA. Here the wildcard | character (vertical bar, next to the backspace key) is used to select whatever .lha OR .lzh file is present in the current directory. Of course, you can name any drive or partition you like, instead of df2:, as the destination.) For more information on Lharc, see the tutorial on archiving in MD29A. And the LhA manual can be found in FF637. ********************  ( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )|( 31 )