Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 7 - Translation Manager / Using the Translation Manager


Translating Files Explicitly

It's possible that your application might open some document files without the assistance of the Finder or the Standard File Package. For example, your application might execute a script that contains the name of a file to open. Because you're bypassing the system software services that invoke implicit translation, you might need to modify your application to perform explicit translation (the conversion of a file or scrap with direct intervention from your application). The Translation Manager provides several routines that you can use to retrieve information about documents and about the document types that an application can open, as well as to translate documents from one format to another.

IMPORTANT
Before calling the routines described in this section, you must make sure that they are available in the current operating environment. See "Checking for the Translation Manager" on page 7-12 for details.
You can use the GetFileTypesThatAppCanNativelyOpen function to get a list of file types that an application can open by itself. This function takes a volume reference number (where the application resides), an application signature, and a pointer to a buffer to be filled with up to 64 file types. It returns a pointer to the list of the file types that the application can open without translation.

You can use the ExtendFileTypeList function to get a list of all file types that the Translation Manager can translate into file types in a given list. This routine takes the original list, the number of file types in it, a pointer to a buffer to be filled with file types, and the maximum number of file types that can be put into the extended list. The ExtendFileTypeList function returns a list of all the file types that can be translated into some type in the original list.

You can use the CanDocBeOpened function to verify that a specified application can open the document that it is being requested to open. It takes the source document record, the volume reference number of the application that is to open the document, the creator application signature, and the list of file types that the application can open without translation. It returns a document-opening method (howToOpen) and document-translation method (howToTranslate). The choices for document-opening method are

The Translation Manager uses howToTranslate to get information on converting the document into a format the application can read. For more information on the CanDocBeOpened function, see page 7-40.

You can call the function TranslateFile to translate a file from one format to another. It takes the source document record, the destination document record, and the howToTranslate parameter returned by CanDocBeOpened. In the destination document record, TranslateFile returns the name and location of the translated file.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996