尝试从文件夹中获取文件列表时出现Applescript错误

时间:2013-11-16 06:23:28

标签: applescript

我无法让AppleScript从文件夹中读取文件列表而没有收到错误消息“无法从文件夹XXX获取每个文件”

set targetfolder to ("DICTAPHONE:DSS_FLDA:")
tell application "Finder"
 set fileselection to every file in targetfolder
endtell

在升级到小牛队之前,这种方式完美无缺。路径是正确的。我在启动盘上使用不同的文件夹尝试了它并获得了相同的结果。

2 个答案:

答案 0 :(得分:2)

尝试使用folder targetfolder代替targetfolder

set targetfolder to ("Macintosh HD:Library:Desktop Pictures")
tell application "Finder"
    files of (folder targetfolder)
end tell

答案 1 :(得分:0)

尝试此操作以获取信息:

set targetfolder to (path to desktop as alias)
tell application "Finder"
    set fileselection to get the name of every file of targetfolder
end tell