Transforming a TXT file in a list, getting wrong
- by Mike
I have a txt plain file that has a list of numbers. One number per line, like:
978-972-722-649-8
978-972-722-646-7
978-972-722-627-6
978-972-722-625-2
978-972-722-594-1
etc.
This list is on a file called file.txt, was created and saved on TextEdit using Western (ISO Latin 1) encoding.
Now I am trying to use Applescript to read this file and transform it on a list.
I have this script
set myDirectory to path to desktop folder as string
set myFile to myDirectory & "file.txt"
try
set open_file to ¬
open for access file myFile without write permission
set myList to read open_file using delimiter return
close access open_file
on error
try
close access file open_file
end try
end try
after running this script, myList contains just ONE item and this item is "97" (I suppose that is the first two numbers of the first entry).
What is going on?
Thanks.