// Simple Text Export for CUE FILE

const
	SCRIPTNAME = 'Export Playlist Items to CUE File v1.0';
	
// Enter the full path and filename of the textfile you want to save the text file to. Remember to copy/rename the file before you run the script on another playlist!	
	TEXTFILENAME = 'C:\Documents and Settings\All Users\Desktop\Playlist.cue';
	
var
	iMax, iItemCount, i : integer;
	szPlaylist, szWarning, szArtist, szTitle, szLine, szI: string;
	currentItem: IPlaylistItem;
	slTextItems : TStringList;
	
begin
	szPlaylist := IntToStr(CurrentPlaybackControl.GetIndex + 1);
	iItemCount := CurrentPlaylist.GetCount;
	if iItemCount < 1 then
		SystemLog(SCRIPTNAME + 'Needs some items in ' + szPlaylist + ', then try again.')
	else
	begin
		SystemLog(SCRIPTNAME + 'Processing Playlist for text file export ' + szPlaylist + ' ('+ IntToStr(iItemCount)+ ' items) to ' + TEXTFILENAME + '.');
		slTextItems := TStringList.Create;
		iMax := iItemCount - 1;
		for i := 0 to iMax do
		begin
			currentItem := CurrentPlaylist.GetItem(i);
			szI := IntToStr(i);
	if i < 10 then
	szI := '0' + IntToStr(i);
			szLine := '   TRACK ' + szI + ' AUDIO'
			slTextItems.add(szLine);
			szTitle := '     TITLE ' + '"' + currentItem.GetTitle + '"';
			szLine := szTitle
			slTextItems.add(szLine);
			szArtist := '     PERFORMER ' + '"' + currentItem.GetArtist + '"';
			szLine := szArtist;
			slTextItems.add(szLine);
			szLine := '     INDEX  01 '+ FormatDateTime('nn:ss:00', ?? );
			slTextItems.add(szLine);
			end;
		slTextItems.SaveToFile(TEXTFILENAME);
		slTextItems.Free;
	end;
end.
