我有一个存储在名为 tempfile.txt 的文本文件中的文件列表。例如 tempfile.txt 的内容如下所示:
/path/to/my/file1.txt
/path/to/my/file2.txt
/path/to/my/file3.txt
我想使用 Applescript 在 Finder 中更改这些文本文件的标签颜色,但无法获取实际的文件对象(而不是作为字符串的文件名和路径)。这是我到目前为止所拥有的:
-- some work has already been done to set tempfile to tempfile.txt
set files_to_update to paragraphs of (read tempfile) -- this works fine
repeat with myfile in files_to_update
set selected_file to POSIX path of myfile -- this works fine
set label index of selected_file to 1 -- trying to set this file to orange fails with error "A property can't go after this identifier"
end repeat
有什么帮助吗?