use scripting additions
use framework "Foundation"
on listFolderContents:thePath
-- this where we'll store the stuff as we collect it; we could use a list, but it could get very long
set finalNSArray to current application's NSMutableArray's array()
-- make NSURL of where to start
set anNSURL to current application's |NSURL|'s fileURLWithPath:thePath
-- call our handler
my listURL:anNSURL inArray:finalNSArray
-- join the strings in the array, and convert it to an AS string
return (finalNSArray's componentsJoinedByString:linefeed) as text
end listFolderContents:
Save again. Now open a new script and enter this:
tell script "<name of script>"
set theResult to its listFolderContents:(POSIX path of (choose folder))
end tell
<name of script> should be whatever you named the first file (minus the .scptd extension).
Click Execute...
--