1

在我的 Applescript 中,我选择了一个我想存储路径的文件(稍后打开)。

当我尝试将文件的路径存储为字符串时,这是我收到的错误:

错误“无法将别名 \"Macintosh HD:Users:Username:Desktop:Folder:File.xls\" 的路径转换为类型字符串。” 从别名“Macintosh HD:Users:Username:Desktop:Folder:File.xls”的路径到字符串的数字 -1700

我怎样才能有效地存储这个文件路径,以便我以后打开这个文件时可以回忆起它?

苹果脚本:

tell application "Finder"
    set filePath to path of (choose file) as string
    set fileName to name of file filePath
end tell

*注意:我也试过了as text

4

1 回答 1

1

这似乎有效:

tell application "Finder"
    set filePathAlias to (choose file)
    set fileName to name of filePathAlias
    set filePath to filePathAlias as string
end tell
于 2013-06-06T15:21:47.467 回答