create lists from text file

Hi

I have run into a problem that I need help to resolve. I could probably resolve this myself given time but I haven’t got much of that at the moment.
I also know that some of you are wizards with text manipulation.

I have a server that sends me text file. When I get AS to read it the result is

" {"Client Details", "Add New", "wANA07968238846", "Max Scianna", "zzzz@masss.com", "xyz12345", "07123 238846", "zzzzz"}
{"Appointment Details", "Delete", "Monday, September 22, 2008 15:00:00", "Monday, September 22, 2008 16:00:00", "wANA07968238846", "I would like to be shot against a blue background please", "12345"}

"

Is there an elegant way to convert this to 2 string lists ie:

set list1 to {“Client Details”, “Add New”, “wANA07968238846”, “Max Scianna”, “zzzz@maxscianna.com”, “xyz12345”, “07968 238846”, “zzzzz”}
set list2 to{“Appointment Details”, “Delete”, “Monday, September 22, 2008 15:00:00”, “Monday, September 22, 2008 16:00:00”, “wANA07968238846”, “I would like to be shot against a blue background please”, “12345”}

Many thanks

On the face of it, this is what you want:

set fileText to " {\"Client Details\", \"Add New\", \"wANA07968238846\", \"Max Scianna\", \"zzzz@masss.com\", \"xyz12345\", \"07123 238846\", \"zzzzz\"} 
{\"Appointment Details\", \"Delete\", \"Monday, September 22, 2008 15:00:00\", \"Monday, September 22, 2008 16:00:00\", \"wANA07968238846\", \"I would like to be shot against a blue background please\", \"12345\"} "

set list1 to (run script (paragraph 1 of fileText))
set list2 to (run script (paragraph 2 of fileText))

Thanks Nigel sooooo much

That would have taken me ages and I would never had thought of that.

How does run script work?

Regards

Thanks Nigel sooooo much

That would have taken me ages and I would never had thought of that.

How does run script work?

Regards

Hi, weedinner.

It’s one of the Scripting Commands in the StandardAdditions. It can be used to run a script file, a script previously loaded into a variable, a script object, or, as here, some script text. (Obviously, the command has to compile the text and then run the compiled code.) If the script that’s run returns a result, this is passed back to the main script. The result of running a script that only contains a value is the value itself, and that’s how your compiled lists are produced. :slight_smile: