1

有没有办法用applescript在finder中检索所选项目的服务器路径名?

我已经尝试了属性 URL 和 POSIX 路径,但它们只是指向本地文件系统而不是服务器路径,例如:smb://server/folder1/folder2/filename

到目前为止的代码:

tell application "Finder"
    set selectedItem to the selection as alias
    URL of selectedItem --ouput: file://localhost/Volumes/server/folder1/folder2/filename
    POSIX path of selectedItem --output: /Volumes/server/folder1/folder2/filename
end tell

谢谢您的帮助

4

1 回答 1

1

I think this has to do with the way directories work in OS X (and every *nix). AFAIK there are no UNC style paths on a mac. So the only workaround is to make a database of the available windows shares, look up the name of the volume of the file and spit out a 'file://some/server/path' style URL based on that.

At least that's what I did when I had the same problem. Note that smb:// urls won't work for most web apps.

this and this shed some light on to it.

于 2009-07-17T11:56:44.040 回答