Advanced filetyping

back to section start!
Introduction

This chapter resolves the question "How can I get the most out of the DOpus5 filetypes system?". It is about how to get the AmigaOS datatypes system and the DOpus5 filetypes system to work together nicely.

AmigaOS can throw in its feature of being a hierarchical working datatype matching system. This allows easy matching of all picture formats in one filetype for example. DOpus5's flat, priority-based filetype matching system can provide good configurability and context menus.

This part of the tutorial is all about combining the strengths of the two systems to provide something like a hierarchical filetype system with DOpus5. DOpus5 doesn't support a hierarchical, tree-based filetype system yet. Maybe it will in the future. But right now you can emulate it by setting the right filetype priorities.

A tree-based hierarchical filetypes system means something like this:

  • All
  • All, Directories
    • Picture
      • ILBM
      • GIF
      • JPEG
    • Text
      • HTML
      • ASCII
    • Video
      • AVI
      • Quicktime

This concept has several advantages when compared to its flat counterpart:

  • ASCII
  • AmigaGuide
  • AVI
  • GIF
  • ILBM
  • JPEG
  • HTML
  • Quicktime

These advantages are:

  • Better readability. All filetypes to do with pictures are one after another instead of being spread over the whole filetypes list.
  • You can define a context menu for the general filetype All and then you can define a context menu for the Picture filetype and if you have a special ultrafast ILBM viewer you can even define a context menu for the special Picture, ILBM datatype. If you then press the right mouse button over a ILBM picture DOpus5 will add all these context menus together!
  • This gives your filetypes an object-oriented approach. The child filetype inherits the context menu from the parent filetype.
  • A good context menu setup for the All filetype will allow for adding icons, duplicating files, splitting files and so on.
  • You just don't need that many filetypes any more. Just set the filetype All DoubleClick action to Multiview or UniView. You can now display every file already. For pictures set it to your favourite image viewer and forget about setting it separately for each different image format.
  • You may only want to add a separate filetype for GIF, JPEG and/or ILBM if you want a different default icon for each of them or you have a special program to only work with one picture format.

If you have a setup with more than 30-50 filetypes this is for you. If you have no good filetypes setup at all this is for you. If you have a good filetypes setup, this is for you anyway (you may still learn some new ideas!).

When using the User Menu editor, you can hold down the SHIFT key when hitting add or copy. This will mean that your new item will be inserted at the current cursor position instead of to the end of the list.



Requirements

The filetypes provided with this chapter of the DOpus PLUS Tutorial don't actually need any extra software to work but some menu entries are happier when they find the software they access.

I recommend that you install AppLauncher at least. This ARexx script allows easy application starting. It checks for the application's ARexx port, loads the application if needed, and then issues the ARexx command to load a file. AppLauncher is configurable and comes with a configuration file for some applications. Read about it in its doc and the special AppLauncher addendum chapter in this tutorial (in the Fun Stuff section).

Some menu entries would like to have the programs installed they start:

All, Directories: DirSize
Picture: ArtEffect, Photogenics, PPaint, ImageConvert (another ARexx script by me;-).
Text, HTML: Voyager
Text, Wordworth: Guess what.

Oh, and you need Directory Opus and an Amiga with AmigaOS 3.x -in hardware or emulated - for it. If you have AmigaOS 2.x you won't get the OS datatype features and this then renders some parts of my filetypes approach useless. You would have to define a very complicated filetype to match all picture formats for example.



Installation

  1. Backup the filetypes in your DOpus:Filetypes drawer! Don't say we didn't warn you!
  2. To avoid conflicts with your existing filetypes setup delete all the filetypes in DOpus:Filetypes.
  3. Look in the filetypes directory of the CD and copy the filetypes of the drawer for your language to your DOpus5:Filetypes drawer.
  4. If you use UniView from Stefan Ruppert you may want to copy the filetype All from the UniView directory to DOpus5:Filetypes. This starts UniView instead of Multiview on a double click.

If you are a experienced DOpus5 user with a good filetypes setup you may only want to look at it and then restore your old filetypes setup again. But as you made a backup this should be no problem!

If you are a experienced user you may want to install just some of the provided filetypes without deleting your filetypes first. Do so, if you want. But don't blame me or GP Software if you get conflicts between filetypes.

You may want to buy, install, configure the other programs and scripts recommended in the requirements chapter.

You might have to change the DOpus functions of some menu entries to use other paths. However most of the application starting is handled by AppLauncher. Some of the other software (like Multiview or UniView) is installed to SYS:Utilities anyway. But, for example, you may want to use an image viewer different from CyberWindow for your images.



Usage

This part is not only about how to use the filetypes - that's not that difficult. It's more about the way it was thought up. It explains how you can extend this hierarchical filetypes setup or create your own.

  • Structure

    You may have noticed that I use two All filetypes:

    • All
    • All, Directories

    All is all, there can't be more than All you may think. This may be true from a logical point of view. But hey, we're using a computer. Have computers ever been logical? ;-)

    OK, here is the real explanation: most things you can do with files you can't do with directories, like splitting a file for example. It's also very hard (if not impossible) to setup a filetype which matches both directories and files correctly all the time.

    If you want to add something to the hierarchical filetypes be sure that you add it to the group where it belongs. When you add a filetype for a text format under the Picture-group you loose the readability you got from this concept.

    You may have noticed that some groups don't have a group filetype, like the Archive group. This is due to the problem that a normal AmigaOS datatypes setup doesn't provide datatypes for archives. And even though Stefan Ruppert's cli.datatype supports viewing of archive contents through the archivers themselves with special descriptors these special descriptors matching archives give cli as main type. So I am not able to easily match all archive formats in one filetype.

    Some other don't have a group filetype because they actually don't need one. So it goes with the Video group. With special datatypes Multiview or UniView can display animations on AmigaOS 3.1, even MPEG. But the speed that most users can get out of it is nearly unusable. Also Multiview and UniView are already defined as context menu entries in the All datatype.

    The group filetype does filetype matching via the datatypes system of AmigaOS. It can return two sorts of datatype information:

    Datatype group such as:

    • anim = Animation.
    • cli = cli.datatype from Stefan Ruppert.
    • docu = Documents, hypertexts.
    • pict = Picture.
    • soun = Sound.
    • text = Text.

    Datatype ID such as:

    • pict: png, ilbm, jfif = JPEG JFIF images
    • docu: amig = AmigaGuide, hype = HyperGuide, html
    • ...and so on.

    Opus then has two filetype matching commands, one for the datatype group and one for the datatype ID called "Match DT Group" and "Match DT ID" which can be used.

  • Priorities

    If you add a new group filetype - if you need one - be sure to set its priority to -1.

    Priorities are *very* important in this filetypes setup:

    • All should have -126 as priority.
    • All, Directories -125 so that All doesn't match directories.
    • Each group like Picture, Sound and such should have a priority of -1 so that they are matched after the filetypes defined for special formats such as Picture, ILBM.

    Why? With this scheme of setting priorities you ensure that the function you define for your action is set to the most specific filetype. So you really get your special JPEG image viewer for JPEG pictures, instead of Multiview or UniView from the All filetype for example. This also applies to the default icons you set and the filetype ID.

    In one sentence: You wont get the special features of the sub-filetypes if you set them to a lower priority than the group filetypes ones.



Tricks

Here are some tricks, most of which got used in the All filetype.

  • The All filetype

    The All filetypes drag and drop action is set to COPY MOVEWHENSAME. This emulates original Workbench behaviour when you drag and drop a file. Workbench copies the file when it is dragged to a different partition and moves it when it is dragged to a different directory on the same partition. DOpus5 normally just copies the file. I did this in the All, Directories filetype as well.

    I also added some other menu entries to the All filetype for splitting or duplicating files, for deleting files completely even on PFS like filesystems - this uses the Wipe command to be found on AmiNet - and for adding icons or making icons borderless. This way I can set a default icon for special filetypes like the filetype Picture for example and use this menu entry to add this icon to an existing picture file.

    I also added some menu entries for finding a filetype or creating a new filetype. This is to allow to you invoke the filetype creator or filetype finder of Opus easily. Normally Opus invokes the filetype finder on every file it can't match to a filetype. But the All filetype matches all files and thus there is no file that can't be matched anymore.

    Last but not least I added some menu entries to edit files. You may want to differentiate between readable ASCII files and unreadable binary files, but I didn't care about it. I guess you can add this feature on your own, if you want. Send me a copy of it then. ;-)

  • The All, Directories filetype

    With the All, Directories filetype you can also do nice things. Try double clicking on a directory while pressing Ctrl. You will then get the size of the directory with the GetSizes command. In the context menu there is also a menu entry using the shell command DirSize for that. You can find this command on AmiNet. Additionally you can check whether the directory fits on the destination or not.

    You will also find the menu entries for adding icons here as well.

  • The All, Version check filetype

    This matches all libraries, devices, datatypes, gadgets, classes, Opus modules (except Opus ARexx modules) and MUI custom class files. Double clicking on such a file will tell you its version. Could it be any easier?

    Note: This filetype only uses the filename for matching. So it isn't 100% reliable.

  • The Image filetype

    It has context menu entries for loading an image into an image manipulation application such as ArtEffect, Photogenics or Personal Paint. It uses my AppLauncher script for that purpose. See the AppLauncher tutorial and documentation for this.

  • Other filetypes

    The HTML filetypes starts Voyager on double click, also by using AppLauncher. You can use AppLauncher to start IBrowse or AWeb as well if you want. See the AppLauncher tutorial and documentation.



Known Problems

The Wordworth filetype only seems to work as expected if Wordworth is not already running. I didn't manage to get it to work together with AppLauncher.



Pick a chapter:

DOpus PLUS - giving you that bit extra...