Чтение текстового файла в список в Applescript

Я попытался создать AppleScript, который читает текстовый файл и помещает содержимое в список. Файл представляет собой простой текстовый файл, каждая строка которого выглядит следующим образом:example-"example"

Первая — это имя файла, а вторая — имя папки.

Вот мой код сейчас:

set listOfShows to {}
set theFile to readFile("/Users/anders/Desktop/test.txt")
set Shows to read theFile using delimiter return
repeat with nextLine in Shows
    if length of nextLine is greater than 0 then
        copy nextLine to the end of listOfShows
    end if
end repeat
choose from list listOfShows


on readFile(unixPath)
    set foo to (open for access (POSIX file unixPath))
    set txt to (read foo for (get eof foo))
    close access foo
    return txt
end readFile

Когда я запускаю этот вывод, я получаю это:

error "Can not change \"Game.of.Thrones-\\\"Game Of \" to type file." number -1700 from "Game.of.Thrones-\"Game Of " to file"

Мой список выглядит так:Game.of.Thrones-"Game Of Thrones" и еще две строки в том же духе.

5
задан Kerr 23 January 2016 в 16:22
поделиться