Pasting the contents of two lists into TextEdit

tell application "TextEdit"
	activate
	make new document at the front
	set text of front document to ("Orders without Images" & return & (faulty_list as string) & return & return & "Image Files without Orders" & return & (allFiles as string))
end tell

So this is the portion of the script that I have calling for TextEdit to past the contents of two lists into the new document under the proper headlines.

This works, except for the fact that the list prints out without a single character between each item of the list.

In other words, if the faulty list is {1, 2, 3, 4} - the list pastes into textEdit as 1234. Does anyone know how to get a ", " between each item in the list?

You can use text items delimiters. (See a similar example here: Looping)

set faulty_list to {"1", "2", "3", "4"}
set allFiles to {"hello", "world"}

tell application "TextEdit"
	activate
	make new document
	
	set ASTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {", "}
	
	set text of front document to ("Orders without Images" & return & (faulty_list as string) & return & return & "Image Files without Orders" & return & (allFiles as string))
	
	set AppleScript's text item delimiters to ASTID
end tell

Beautiful! Thanks!

Hi guys.

Just a small point, really - but it may be worth noting that explicitly coercing values (such as lists) to a string is not necessary when performing a concatenation that starts with a string. Since AppleScript will automatically try to coerce any subsequent values to a string, you should be able to modify the penultimate line of the above tell statement to:

set text of front document to "Orders without Images" & return & faulty_list & return & return & "Image Files without Orders" & return & allFiles