The Adding of an Extension

Home

What's new?

Help

Plug-ins

Plug-in Tutorial

  1. introduction
  2. talking to AEP
  3. processing
  4. making it better
  5. another removal
  6. add an extension
  7. some tips

Download

The WhatDoYouHandle routine revisited

Plug-ins that handle the adding of extensions are very similar to those that deal with their removal, but there are differences. In this part we will go into those. You should begin by opening the Template AEP addable plug-in file in the template folder and save it as something like Nutcase GnuZip.

The WhatDoYouHandle of a plug-in for adding file extensions looks like this:

As you can see, it greatly resembles the WhatDoYouHandle function of a plug-in for removing file extensions. There are just four more things you have to tell AEP about.

  • CanDoFi: can the plug-in handle files?
    For most plug-ins the value of this item shall be true. If you are not sure, just drop a file on your handler application. If it is processed as it should, fill in true, otherwise false. When you try this with the Nutcase Gzip application, you will see that it can handle files.
  • CanDoFo: can the plug-in handle folders?
    Not every application can process a folder, even though most can. When you drop a folder onto Nutcase Gzip, you will see that it tries to process the folder, but fails and produces an error message. This is because the gzip-format doesn't support folders. The value of CanDoFo in your new plug-in you should thus be false.
  • All2Fi: does the plug-in turn all items into files?
    Some helper applications, most notably compression applications, will turn out just one file. AEP needs to know this, because the user might have added several file extensions. If one of them turns a folder into a file and a next plug-in cannot handle files, it would result in an error. To test this, just drop a folder onto the helper application. (Of course, if your plug-in tells AEP it doesn't work with folders, it doesn't matter what you put here.)
  • CanDoRsrc: can the plug-in handle resource forks?
    Macintosh files used to have two forks in which they could store data. Most other operation systems have only one, the data fork. When you use an application or encoding format that can only deal with the data fork you lose the resource fork, which might make your file unusuable. There are several ways to test this, but as a quick and dirty way you just drop an Applescript file made in Script Editor on the application. If the application warns you that it cannot handle resource forks, like Nutcase Gzip, or if it does not and Script Editor won't open the processed file, (don't forget to decode it), you should use the value of false.
Knowing this, it is again up to you to try and write the necessary WhatDoYouHandle function for Nutcase Gzip. Don't forget to include a description!

Now you need only supply the plug-in with the application name and creator code for the DoYourStuff routine and you are done. I trust you will be able to do this yourself, but if you are unsure, have a look at the previous parts of this tutorial.

And that is all I'm going to tell you about adding extensions and plug-in. That leaves just some tips in the sixth part of this tutorial.


A.E.P. The Active Extension Processor - Created by Roger Jolly - Copyright 2002 - All rights reserved.