How to get the path to the selected item in a search device
Is there a way to get the pathname of the selected item in finder using applescript?
I tried the properties url and the POSIX path, but they just point to the local filesystem, not the server path, e.g .: 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
thanks for the help
+1
a source to share
1 answer
I think it has to do with the way directories work in OS X (and every * nix). AFAIK there are no UNC style paths on Mac. So the only workaround is to create a database of available Windows shares, look up the volume name of the file and extract from the url 'file: // some / server / path' based on that.
At least that's what I did when I had the same problem. Please note that smb: // URLs will not work for most web applications.
+1
a source to share