Suppose your system contains an application named xgif, which displays GIF pictures. Ordinarily, you run the program by executing:
xgif filename
You want to be able to display GIF pictures several ways:
By double-clicking a GIF data file
By selecting the data file and choosing the application from the Selected menu
Open a new file HomeDirectory/.dt/types/GifViewer.dt for editing.
Type the data type definitions:
DATA_ATTRIBUTES Gif { DESCRIPTION Gif image file. ICON GifIcon ACTIONS View } DATA_CRITERIA Gif_Criteria { DATA_ATTRIBUTES_NAME Gif NAME_PATTERN *.gif }
Type the action definition for the GifViewer action:
ACTION GifViewer { EXEC_STRING xgif %(File)Arg_1"Gif file to view:" WINDOW_TYPE NO_STDIO DESCRIPTION Double-click or drop a file to \ start the Gif viewer. }
Since the definition does not include an ICON field, the action will use the system's default icon.
Type the following map action to connect the GifViewer action to the View action listed in the data type definition. Use the ARG_TYPE field to restrict this view action to Gif-type files.
ACTION View { ARG_TYPE Gif TYPE MAP MAP_ACTION GifViewer }
Save the file.
Double-click Reload Actions in the Desktop_Tools application group to reread the database.