Remove paragraph break and replace with a comma.

Hi
I have become a little stuck, and need help from the gurus of applescript.
I am trying to write a script that will be used to file files back along a path, which is partly hard coded and part variable data, supplied by the operator.
I am currently stuck at a point where I perform a cat on a unix server of a folder, which returns a list of the contents of the files in this folder (each file contains one line of text).
I am then writing this out as a file, reading this back again :/.
What I am trying to achieve is to get the return of the cat, then replace the breaks with commas, so that I can then choose from a dialog list, the name I want to use.
this is an example of what I have tried so far.
the variable array_list is where I want to return the file client-list in this format “Client1”,“Client2”,“Client3”,“Client4”,etc.
So that I pick the client from a list. Prerebly a drop down list would be good.
many thanks in advance.

tell application "Finder"
	set shell_part_one to "rsh -l user host1" as string
	set shell_part_onea to "rsh -l user host2" as string
	set shell_part_two to "cat /path/to/files/*" as string
	set string_total1 to shell_part_one & " " & shell_part_two
	set string_total2 to shell_part_onea & " " & shell_part_two
	try
		do shell script string_total1 & " >/tmp/client-list"
	on error
		do shell script string_total2 & " >/tmp/client-list"
	end try
	set theText to (read file "tmp:client-list")
set array_list to {listoffiles}
set display_return to (choose from list array_list)
end tell

Here’s a direct approach:


set S to alias ((path to desktop as text) & "Serve:")
tell application "Finder" to set SF to files of S as alias list
set L to {}
repeat with F in SF
	set L's end to read F
end repeat
set Pick to choose from list L

I should really give a better description of a problem before posting :frowning:

We have a list of clients contained in a folder on our unix server, this is being used by another application for other purposes. So rather than ask the operator to specify the client, I wanted to obtain a list from the server, and present it to them in a manageable way. So all they have to do, is pick the client, and this then is used inside the folder structure.
I have managed to obtain this now, as a list, but would of preferred a drop down box. Although I believe for this I need to have some third party software.
Anyway this is what I have come up with which helps me achieve my aim.
Any help in streamining this is appreciated. The main reason for reading the directory is so that when we add or remove clients, the script will automatically update itself, removing human error.

tell application "Finder"
	set shell_part_one to "rsh -l user host" as string
	set shell_part_onea to "rsh -l user host2" as string
	set shell_part_two to "cat  /path/to/files/*" as string
	set string_total1 to shell_part_one & " " & shell_part_two
	set string_total2 to shell_part_onea & " " & shell_part_two
	try
		do shell script string_total1 & " >/tmp/client-list"
	on error
		do shell script string_total2 & " >/tmp/client-list"
	end try
	set AppleScript's text item delimiters to {"
"}
	--set oldDelims to AppleScript's text item delimiters
	--set AppleScript's text item delimiters to {","}
	set theText to (read file "tmp:client-list" using delimiter {"
"})
	--set count_total to total of theText
	set thelist to text of theText
	set pick_list to (choose from list thelist)
	set the_chosen_one to pick_list as string
	--set AppleScript's text item delimiters to oldDelims
end tell