                       The File Associations BTM

 --------------------------  Quick Start  --------------------------

 Included are two sample BTMs:

 The smaller one has some basic file-associations and is meant to get
 you up and going quickly to test this BTM.

 The larger one, has some minor comments and includes MENUs and a few
 other things.

 There is also a file called "files.txt" which provides information on
 some of the software mentioned, some personal comments and some other
 program choices.

 I tried to include many of the more popular extensions. For some of
 the 'business' exts and programming parameters, options are as wide
 and varied as 4dos will allow.

 Finally, you can have the BTM recognize unique 'paths' and specially
 created extensions to perform any task. For example, on the extension
 "pri", so can have the BTM decrypt a file and then load your editor.
 When done, it will encrypt that file again and return you to your
 file manager.

 In the end, it allows you to sculpture and integrate your 4DOS environment
 with an interface you are already comfortable with -- your File Manager.

 [Historical note: I had originally uploaded a file called "edit-btm" some
 months back but used DOS's "choice" for menus, and didn't include keeping
 directory trees intact when unzipping (as a default in the sample btm).
 This update fixes that and adds a few more extensions to the mix. It also
 includes 'files.txt' as an additional aid]

 -------------------------  Documentation  -------------------------

 As a fairly new user of 4dos, I recently started going over some of the
 syntax for retrieving file information. There are indeed some powerful
 features inbedded in the 4dos system as many of you are aware.

 It occurred to me to use one of the "simpler" functions to add greater
 functionality to programs, such as File\Dir Managers, that call on an
 "edit" or "edit.bat" to load a text-editor.

 Since I use Vernon D. Buerg's "list.com", I'll use it as an example.
 However, it should work with any such Managers or other programs (ie,
 COMM, etc) that call on an external batch (btm) file.

 "List.com" calls the file "edit" to load a text-editor by pressing the
 letter "e". In this case, it would load the "edit.btm" file instead
 and quickly run a set of conditions.

 The way my BTM is presently configured, pressing "e" on a WAV file
 would generate "plany file.wav" and play the WAV file. Any extension
 that has a supporting program generally takes the form of "program %1".

 [you can modify this in anyway for any extension...]

 Pressing "e" on a ZIP file would create a subdirectory using the filename
 of the zip (no extension), a secondary subdirectory within the first called
 MISC. It would then proceed to unzip the file (directory structure intact)
 into the newly created directory (.\newdir) and move the whole zip into
 ".\newdir\misc".

 [you can easily add other codecs\redefine the decompression method]

 A casual examination of the file will reveal that if none of the conditions
 are met (ie, there are no matching extensions), then your editor will
 load. There is one exception (as presently configured), pressing "e" on
 any directory (which would not generate a filename), would load an external
 program.


 ******************************   IMPORTANT   ******************************
 You will need to supply your own program names into the sample BTM included
 ***************************************************************************


 I'm not certain whether a similar program or BTM exists that was designed
 to perform this particular function. I didn't come across any. Though I
 don't doubt there are a few out there...

 The reason I decided to upload this BTM is because it has already proven
 it's usefulness, time and again, in the short time I've had it. Handy
 little thing, actually -grin. I figured some of you folks could modify it
 to suit your particular needs. While there are other ways to get this BTM
 to accomplish what it does, the method included appears to be the most
 "user friendly".

 I created this BTM a few days ago and have been using it as an all-purpose
 assist program for "list.com" without any problems. It can certainly be
 used as a command-line BTM for calling in any program on your drive, to
 display, play, edit files... No need to remember any filenames. It might
 not even be a bad idea to create two BTMs for the command-line:

 1) An "edit.btm" (that always calls editing programs for music, graphics,
    text, etc) and

 2) a "play.btm" (that would always call the displaying program of choice).

 In the end, this BTM is a personal 'hackers' tools to help more fully
 intergrate your operating environment. I have already started to add
 more functions (mostly more filename extensions) since I last wrote this.
 The menu systems are convenient, as was a recent addition whereby I loaded
 a different program depending on the size of the file.

 I hesitated to write a description, as many users are probably well versed
 on the syntax used... some of you just getting started might appreciate a
 little more information. Toward that end, I created four basic help
 sections following this doc.

 There is also an additional file included here called "files.txt" with
 some of my personal choices for programs, syntax and comments.

 The toughest part was writing the docs, which I don't feel are ever really
 finished. Sometimes less is more :)  The experienced user would probably
 simply need one sample BTM and take it in all kinds of different directions,
 while an inexperienced user would need more help with syntax, programs,
 etc... So much of what's included here is done for the latter.

 Anyway, hope the additional information provided with this zip helps.


 Regards,

 Christian dela Cruz

 cruzing@concentric.net
 www.concentric.net/~Cruzing
 January 5, 1997

 (edited March 22, 1997)

 Comments, suggestions are always welcomed.

===============================================================================
                           H e l p  S e c t i o n
===============================================================================
Below is a sample BTM:
----------------------

Part One:
---------

if "%@EXT[%1]"=="gif" goto qv1
if "%@EXT[%1]"=="wav" goto plany1

The syntax above would read as such:

line 1: if (the extension of the filename) equals (gif) goto qv1

        [note, if the extension does not equal "gif", the next line is read..]

line 2: if (the extension of the filename) equals (wav) goto plany1

        [this process continues forward, until a match is found]

The lines are read, in order, one at a time... until a condition is satisfied.
===============================================================================
Part Two:
---------

When a match is found (an extension equals a specific extension), the
BTM file will go to the "label" specified. This "label" (or address)
in the BTM is always preceeded with a colon (:).

If "list.com" supplied a file named "file.gif", it would meet the
condition: ( if "%@EXT[%1]"=="gif" goto qv1 ),  and "goto" the label
identified as "qv1" below:

:qv1          << name of label
qv %1         << qv is the name of a program that displays "gif" files
quit          << ends batch processing at this point

:plany1
echo.
echo        Now playing...  (%1)
plany %1
quit

[note: a "goto" label can travel 'up\down' in a batch file. You can also
 name it anything you wish]
===============================================================================
Part Three:
-----------

==    (equal sign)

%1    (this represents the FIRST file named after the batch file. Example:
       "edit.btm file001.ext", %1 would expand to "file001.ext")

@EXT  (The extension of a supplied filename)

"  "  (If I had left out the quotation marks in %@EXT and gif, then the
       "values" would be compared instead of the supplied "strings")

@NAME (filename without path or its' extension)

===============================================================================
Part Four:
----------

Some comments using a sample BTM file.

EDIT.BTM:
=========
@echo off
if "%@EXT[%1]"=="gif" goto qv1      --> You know this stuff already
if "%@EXT[%1]"=="avi" goto qv1      --> from the above :)
if "%@EXT[%1]"=="fli" goto qv1
if "%@EXT[%1]"=="flc" goto qv1
if "%@EXT[%1]"=="mpg" goto mpeg1
if "%@EXT[%1]"=="wav" goto plany1
if "%@EXT[%1]"=="voc" goto plany1
if "%@EXT[%1]"=="jpg" goto qpv1
if "%@EXT[%1]"=="mod" goto dmp1
if "%@EXT[%1]"=="mid" goto play1
if "%@EXT[%1]"=="exe" goto EXECUTE
if "%@EXT[%1]"=="com" goto EXECUTE
if "%@EXT[%1]"=="zip" goto pkunzip1
if "%@EXT[%1]"=="htm" goto htm1
if "%@NAME[%1]"=="" goto program1     --> If no filename supplied, goto label


:sled1                   } name of your editor
sled %1                  } If none of the conditions above are met,
quit                     } the BTM defaults to this label.

:qv1                     } QV is a shareware program for displaying
qv %1                    } many picture formats and animations.
quit

:mpeg1                   } Shareware player for xing\non-xing mpg files
c:\path\ismpeg  %1 /p /l
quit
rem this requires dos4gw.exe program in path

:plany1                  } Freeware command line player for WAV\VOC\AU\...
echo.
echo        Now playing...  (%1)
plany %1
quit

:qpv1                    } QPV is a fast graphics viewer for DOS.
qpv %1
quit

:dmp1                    } DMP will play music MOD files.
dmp %1
quit

:play1                   } command line program for playing MID\CMF\others...
echo.
echo        Now playing...  (%1)
play %1
quit

:EXECUTE
echo loading program... (no command line options)
drive:\path\%1
quit

:pkunzip1
md %@NAME[%1]                   } Creates dir using zip filename (no extension)
pkunzip -d %1 %@NAME[%1]        } Unzips file (w\ "d" switch) into new dir.
md %@NAME[%1]\misc              } Creates subdirectory "misc"
move %1 %@NAME[%1]\misc         } moves original zip to "misc" subdirectory.
quit                            } Note: If your file manager supports "tagging"
                                } files w\editor, maybe %1, %2, %3 could work??

:htm1
echo.                                               } Menuing example using
echo.                                               } 4dos's INKEY.
echo.
echo                  Press 1  to view (BOBCAT)
echo                  Press 2  to view (KNOTS)
echo                  Press 3  to view (ARACHNE)
echo.
echo                  Press 4  to edit (SLED)
echo.
echo.
inkey /K"1234" /P Press 1, 2, 3 or 4: %%mykey
   if "%mykey" == "1" goto htmview1
   if "%mykey" == "2" goto htmview2
   if "%mykey" == "3" goto htmview3
   if "%mykey" == "4" goto editor

:htmview1                                         } DOS based WWW browser
e:\bobcat\lynx file:///%1                         } used to load single htm
quit                                              } page (text-based)

:htmview2                                         } DOS graphical htm viewer
e:\knots2_0\knots %1                              } accessed only by menu above
quit

:htmview3                                         } DOS graphical browser.
e:\arachne\core %1                                } Erases some files it
erase arachne.pck tadyjsem.byl tohleuz.mam > nul  } creates on loading
quit

:program1                  } Program will load and execute when there is no
drive:\path\progname.exe   } filename supplied, pressing "e" on any directory.
quit                       } Good for tying in another File Manager with other
                           } features, password protector, screen saver, etc
:end                       } Can also create a MENU system for many functions

===============================================================================

