Lionel_A
Lionel_A

Reputation: 570

Im trying to create a list from a delimited text file

set definitionsPath to "/Users/toto/Desktop/Definitions.txt"

set defs to POSIX file definitionsPath

set temp to defs as string

set defs to read file temp using delimiter {"§"}

But it doesn't work. The AppleScript list isn't created

I've tried to fill the text file by using different approaches :

text1§ text2§ text3§

"text1"§"text2"§"text3"

What should I do ?

Thanks.

Upvotes: 0

Views: 51

Answers (1)

vadian
vadian

Reputation: 285260

Put each item in a new line for example

Text1
Text2
Text3

Then read

set definitionsPath to "/Users/toto/Desktop/Definitions.txt"
set defs to paragraphs of (read definitionsPath as «class utf8»)

As almost all text files are UTF8 encoded it's crucial to add as «class utf8», the default text encoding of AppleScript is MacRoman

Upvotes: 1

Related Questions