A snippet to create a file in m3u and pls. It seems to work with winamp 5.24, so I guess it's correct :)
switch -- $form { m3u { set output "#EXTM3U" foreach l [array names tracks] { append output [format "#EXTINF:%d,%s\n%s\n" \ $tracks(length) $tracks(title) $tracks(location) } } pls { set output "\[playlist\]\n" set count 1 foreach l [array names tracks] { append output [format "File%d=%s\n" $count $tracks(location)] append output [format "Title%d=%s\n" $count $tracks(title)] append output [format "Length%d=%d\n" $count $tracks(length)] incr count } append output [format "NumberOfEntries=%d\nVersion=2\n" \ $count ] } default { error "unknown file format" } } set fh [open $path w] puts -nonewline $fh $output close $fh