## Export

Create playlists and export information about your music collection to user-defined file formats.

Tagscanner comes with predefined scripts for most popular formats like CSV, XML, HTML. You can change filename for exported file and encoding of content.

Use CSV (Comma Separated Values) format if you want to work with database software like Access or MySql.

### Export scripts

Export feature uses simple scripting language so you can create your own script to generate required file format.

Export script contains two sections: exported file configuration (reflected in program interface) and loops which generate content of this file.

1. Configuration
$file_name TrackList.csv
$file_notes Raw comma-separated text
$file_encoding utf-8
$file_writebom 1
2. Content
$document_open
$select %_index%,0
%title%;%artist%;%album%;%track%;%year%;%genre%;%_length_sec%;%_filesize%;%_filedate%;%filepath%;%filenameext%
$endselect
$document_close

You can specify any text and unlimited number of placeholders as configuration parameters and content of exported file.

List of avalaible configuration parameters

$file_name | Name of exported file. Can contain absolute or relative path to generated file
$file_notes | Description of script visible in program interface
$file_encoding | [ansi, utf-8, utf-16] Encoding of file content
$file_writebom | [0 ,1] Write unicode Byte Order Mark (BOM) required for some software to detect the Unicode data in a file
$file_ishtml | [0 ,1] Option replaces all special characters like & with special html-friendly equivalents.
$file_relativepaths | [0 ,1] Option change all used file paths to relative to current file

All content between $document_open and $document_close will be placed inside generated file.

Command $select %any_fields%,0 selects files with values according to first parameter and starts a loop. Command $endselect is marker of ending of repeating part.
If you want to limit number of selected entries (i.e. to avoid duplicates) just set number of required elements in second parameter.
All selected entries are sorted by the selection parameter.
You can use up to 10 nested selects.

There is a special placeholders which can be used inside export scripts:

Special
%_now% | Timestamp
%_version% | TagScanner version.
%_gcounter% | Counter from 1 to number of affected files
%_even_odd% | Print 'even' or 'odd' for current file
Current loop
%_totalfiles% | Total number of files
%_totallength% | Total playback length
%_totalsize% | Total size of files
%_counter% | Counter from 1 to number of selected entries