How do I write an m3u file from an array of filenames in JScript? My script outputs all the filenames in the current source tab to the script output window.
http://pastebin.com/MEaNSwsU
A basic M3U file is just a text file with one filename per line, so you just have to open a file and write to it.
You can use the FileSystemObject that Windows provides to write text files from scripts: msdn.microsoft.com/en-us/library ... t8(v=vs.84.aspx
I don't think you can use the FileSystemObject in JScript without using internet explorer. You would also need to change the trust level in the internet options. I have internet explorer uninstalled. The FileSystemObject works fine in VBScript though. Would you consider adding a new "Write" method name to the command object?
The info here makes it seem like there's very little difference between accessing it from JScript and VBScript.
I got it working now.
Updated pastebin
http://pastebin.com/MEaNSwsU
Nice script!
- At the last line of your script one "}" must be deleted.
- You should take care that only music files are selected because the script also adds other files (like coverart.jpg or folder.jpg) to the m3u if present. My player does'nt like such m3u's.
@jhn431 Thanks for sharing the script.
I was about to say that it would be nice to have it generate .m3u8 files (it is basically the same file in utf8, allowing non-ascii languages), but
when I looked at FileSystemObject, it doesn't seem to support UTF8, only ansi or unicode (which I assume would be utf16). 