## File to Tag

This function traditionally is used to apply a single File to Tag template to every selected file. When applying a single template the template can be chosen from the popup list or manually entered. The only reason to manually enter the template name is if you wish to specify the name at runtime. The template field may contain any of the escape sequences described in Escape Sequences. Note that regardless of the execution mode, the template field is only evaluated once. As this is the case it may be more appropriate to indirectly specify a template in a named variable as opposed to one of the Variable 0 through Variable 9 fields.

If you select the File to Tag by testing successive templates in named variable option, you can do the following:

- Setup a named variable to be a list containing the names of File to Tag templates separated by the default list delimiter (\~).
- Specify a Variable to contain the result.
- For every selected file, the File to Tag templates in the list will be successively processed, until one template succeeds or the list is exhausted. Success is defined as extracting something. It is up to you to order and construct the templates to discard inappropriate patterns.
- The specified result variable in each file will contain either the name of the successful template or will be cleared.

As an example you have two templates. One which looks for filenames containing a track number and title. The other containing a year in parenthesis and a title.

Template named Track Title
  ❨Required Once❩❨Numeric Once❩❨Track❩·❨Title❩
Template named Year Title
  ❨Required❩(❨Year❩❨Numeric Once❩)·❨Title❩

Note that each of the above templates are designed to fail unless the required metadata can be extracted. The following sample action would enumerate the File to Tag templates:

> Set named variable 'List' to "Track Title\~Year Title"
> File to Tag using list in named variable 'List', result to Variable 1

Additional information can be found in:

Preferences - File to Tag templates

The File to Tag Template Editor

The File to Tag from Content Action Statement