How can I create a text file with DOS linebreaks?

I’m trying to create an .m3u playlist for my mp3 player. The m3u format specifies a text file that uses DOS linebreaks. Is it possible to create a text file with DOS linebreaks using either TextEdit or Tex-Edit Plus? I’m not sure what DOS linebreaks are but suspect they’re “/r/n”. Here’s what I have so far:

tell application "TextEdit"
	make new document at front
	set name of window 1 to ("MyFile" & ".m3u")
	tell document 1
		set paragraph 1 to "Now is the time" & "rn" & "for all good men" & "rn" & "to come to the" & "rn" & "aid of their country."
	end tell
	save document 1 as Unicode text in folder of "Dusty:Users:joe:Desktop:TEST FOLDER:" --doesn't work
end tell

If you must use the apps you mentioned, I don’t have a solution, but if you can use another program, BBEdit and JEdit both can edit and save files with DOS line endings.



In Tex-Edit Plus, go to menu item Tools > Quick Cleanup > Add CR/LFs (Mac → DOS).


I believe that DOS uses ascii chars 10 and 13 for line breaks. You may be able to write the characters into a file using AS and bypass using some another app entirely. Perhaps something like this would work…

set myFile to "Macintosh HD:Users:jobu:Desktop:test.txt" as file specification
set myText to ("Greetings, " & (ASCII character 10) & (ASCII character 13) & "how are you today?")
	open for access myFile with write permission
	set eof of myFile to 0
	write (myText) to myFile starting at eof
	close access myFile
end try

It’s late and I’m delirious, so this is just a shot in the dark… 8)