                                 TypeFind
                    By David Sharp and Ben Schofield


                                 Manual
                                 ~~~~~~

     Have you ever wanted to load up a file, and been unable to do so because
the icon was blank, and you didn't know which program it had come from? Yes?
Then this program is for you - and many others who need to set un-filetyped
files.
     TypeFind is a utility which can recognise over a hundred and twenty
types of file which do not have their filetypes set. It has intelligent
guess routines which should still guess the types of files if the internal
format has changed slightly, and also keep a certainty score for the file
being scanned.This means that if TypeFind knows about a certain type of file,
it should get it first time - and if it doesnt, I want to know about it.
TypeFind can handle batch operations (ie directories), and provides an
extension of the normal main window to do this.
     In the rare event of you coming across a file that TypeFind doesnt
guess first time, full Guess Again and Previous Guess facilities are
available. TypeFinds certainty score system will make sure that every time
you click on Guess again the next best filetype will be displayed.
     TypeFind will have many uses to the serious Acorn user. Besides the
obvious ones such as reliably setting the types of files downloaded from
Bulletin Boards and the other wealth of information and file sources
available (TypeFind recognises industry standard files like GIF, TIFF, MIDI,
CSV and TSV), and the use I mentioned earlier of telling you the type of a
file with a blank icon, it also has applications in setting the filetypes of
files which have been recovered from damaged discs, for instance (although
please note that TypeFind has not been tested in safety-critical situations).
     TypeFind is compatible with RISC OS versions 3.0, and 3.1+
(including 3.5), although please note that is is only guaranteed to operate
correctly under RISC OS v3.11. It has been tested on a StrongARM, and works fine.
     Versions of TypeFind upto and including 2.11 were compatible and tested with RISC OS 2 and 2.1 but with the advent of v2.12.0, the MessageTrans system was introduced to allow translation causing TypeFind to have had problems working under RISC OS 2. Luckily I am a great believer in backwards compatibility, and TypeFind should still work under ROS2 but no translation is possible. I have been unable to test this so if you use RISC OS 2 please tell me if it works ok.
     In particular, 3D icons won't appear under a version of RISC OS older than 3.10. As of TypeFind v2.01 onwards, the desktop font should remain constant when TypeFind is used.
     Language selection is now possible. At present only German is also implemented, courtesy of Michael Knig. If anyone is interested in providing another translation I'd be very grateful. To change the language you need to edit the Language file inside the TypeFind application. To do this, load it into edit. Now you must change the first line of the file so that it identifies one language, having either D or GB on the first line and pressing return immediately afterwards, so that the characters of the language code are the only thing on the first line. Don't worry about messing it up, if nothing is defined, or an unrecognised language is defined it simply ignores this setting and defaults to English.

Using TypeFind
~~~~~~~~~~~~~~
     TypeFind is simple to use - just load up the program by double-clicking
on it, and drop the file or directory to be scanned on the TypeFind icon. If
you have a certain Choices option set (see later), it is also possible to
load a file into TypeFind by double-clicking on it with the Action (Right
Ctrl) key held down.
     Files can be loaded into TypeFind by dragging them from the save box of a program to TypeFind also. This will only work with some programs though, and you should note that a copy of the file is kept inside your Scrap directory, and will need to be removed manually.
     TypeFind now uses it's general scan routine on the file, comparing it
against every type of file known to these routines. Due to the
use of machine code here, this takes less than a second even on an ARM2. The
top LED of the egg-timer will be lit whilst this is going on.
     If the file is not recognised here (or the Full Scan option is ticked -
see later), then TypeFind's specific scan routines are activated. These are
much slower, as there is no quick way to recognise these files, but the delay
is still only a second or two on an ARM2. The bottom LED of the egg-timer
will be lit whilst this is going on.
     A window will now open showing what TypeFind recognises the file as. As
well as the type of the file, and a more detailed description from TypeFind,
the number of the guess is displayed along with a percentage, which shows how
sure TypeFind is of its correctness.

     - Clicking on Guess Again will cause TypeFind to guess the next most
        likely type, and increment the Guess counter.
     - Clicking on Previous Guess will cause TypeFind to revert to the
        last type guessed, and decrement the Guess counter.
     - Clicking on Set Type will cause TypeFind to set the filetype of the
        current file to the one that TypeFind is set to at the time.

     If you are currently engaged in a batch operation (a directory), then :

     - Clicking on Skip file will cause TypeFind to move on to the next
        file.
     - Clicking on Abort scan will abort the batch operation.
     - Clicking on Set Type will also cause TypeFind to move on to the next
        file.

     TypeFind supports interactive help via Acorns !Help application.

Extra Features
~~~~~~~~~~~~~~

      TypeFind is aided by my filetype database, Typeinfo so that if a sprite is not available in memory for that filetype, then it is loaded from Typeinfo's vast data and displayed in the window. To enable this, all you have to do is boot TypeInfo v1.71 or later, or just run earlier versions at some point.

      Also, if you want to know more information about the filetype that has been found, you can click on the icon containing the filetype number. This will cause TypeInfo to be loaded, and information on the filetype in question displayed in its window. Note, TypeInfo v1.71 or later must have been 'seen' by the filer for this to work. If you are using RISC OS 3 or later, and typeinfo is already loaded, that typeinfos window will open, rather than loading typeinfo a second time!

Reliability
~~~~~~~~~~~

Because of the way TypeFind works on some of the poorly defined file formats, it is not always 100% accurate. This is because it is entirely possible for one file format to have an identical or similar header format (which is analysed by TypeFind). To get round this, it is well worth thinking about what TypeFind is telling you, for example, the !RunImage file to TemplEd v1.34, which is a BASIC file, is 1st guessed as being a 'Protector' coded file (&1AD) with 96% probability. However, anyone with a bit of background knowledge would find this an unlikely filetype for a !RunImage file, and if you press 'Guess Again' it is recognised as a BASIC file with 100% probability.

To improve the reliability, you can adjust the user choices...

User Choices
~~~~~~~~~~~~
     To get to the User Choices dialogue box (options box), click Menu on
the TypeFind icon (on the icon bar), and select Choices. A window will now
open with the following options:

     Full scan/Stop if 95%+ found - This decides whether TypeFind will check 
files for every possible type, or stop if a 95% or more match is found. You
are advised to set this to Stop if 95%+ found, as if TypeFind finds a 95%
or more match, its almost certainly correct (its also quicker).

     Load in file if double clicked... - If this option is ticked, TypeFind
will load in a file if you double click on it with Action (Right Ctrl, just
left of the arrow keys) held. You may not want this to happen because it
interferes with some other program you use, in which case you should untick
the option.

     Auto-Set filetypes to guesses - If this option is ticked, the filetype
of a file will be set to the current guess without the need for you to
click on 'Set Filetype'. BBSers will probably want this ticked, but other
users won't.

     Don't open window - If this option is ticked, then TypeFind won't open the main window automatically (unless you're doing a batch scan and autoset is unselected)

     Text Certainty Scaling - As almost any file can seem like ASCII text to
a computer, the certainty has to be scaled down - ie a scaling factor of
75% will mean that files which the computer is 100% certain are text will
only actually have a certainty of 75%.

     From here, clicking on Default defaults the choices, Cancel cancels the
operation, and Save sets and saves the choices.

TypeFind's 'ScanData' file format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     If you need to know (you don't to use TypeFind), the format of the
!TypeFind.ScanData file is as follows :

 Address Length Description

 +0      8      Header, "TFScnDat"
 +8      4      No. of entries in ScanData file
 +12     ...    First entry

Format of an entry is as follows :

 +0      4      Offset to next entry or -1 if last
 +4      4      Recognition Number (id)
 +8      4      Filetype
 +12     4      Position of Scan String in file
 +16     1      Length of Scan String
 +17     ?      Scan String
 +x      ?      Description (terminated by null)
 ... next one follows!

Though I recommend you don't try and alter it by hand! See the Source.DatScan file which generates this data.

Contact addresses 
~~~~~~~~~~~~~~~~~

 If you have details of any other files which TypeFind doesnt cover, have
found a bug in TypeFind, or just want to contact me for any reason, then I
can be reached at (in order of preference) :

  1) Email : DavidSharp@ThePentagon.com
          or DavidPSharp@Hotmail.com


All versions of TypeFind prior to 2.10 were written by Ben Schofield, though he has now given up development of the project to myself (David Sharp) so you should contact me with anything concerning TypeFind. His contact details are below for completeness.

  1) Email : monoi@bigfoot.com
          
  2) Fidonet netmail to Ben Schofield at 2:2503/203.26 (checked regularly)
  
  3) Snail Mail : Ben Schofield
                   24 Debdale Lane
                    Keyworth
                     Nottingham
                      NG12 5JD
                      
  4) Phone : (0115) 937 2874, after 4pm (ask for Ben).

Finally...
~~~~~~~~~~
     Thanks to Mark Simmons for some files. Thanks to Adil Khan for info. on
how to recognise Utility code. Thanks to Pete Eastwood for files and hi-res
sprites.
     I hope that you find TypeFind a useful tool. If you have details of any
other files which TypeFind doesnt cover, have found a bug in TypeFind, or
want to contact me for any other reason, then please contact me! Details of
where I can be reached can be found in the file 'Licence.'

Thanks to the following for sending me file format information:
David Pilling
Chris Egan
Neil Raine
Paul Richardson (from ExpLAN)
Henry Morgan (from Carlton Software)
Theo Markettos
Stuart Swales
Michael Koenig
Rik Griffin
Andy Pierson (from ESP)
Nick Clark