I am trying to install this script so that I can email links to co-workers of where files are on our shared NAS server.
tell application "Finder"
set theFile to item 1 of (get selection) as text
end tell
tell application "System Events"
set volumeName to volume of file theFile
set serverName to server of disk volumeName
if format of disk volumeName is AppleShare format and serverName is not missing value then
set filePath to POSIX path of file theFile
set afpPath to "afp://" & serverName & ".local/" & text 10 thru -1 of filePath
display dialog afpPath
else
display dialog "file " & theFile & " is not on a shared volume"
end if
end tell
But when I test the link out and email it to myself, I get an error message saying there was a problem connecting to the NAS server. But I am connected otherwise and can access all the files on there. What is wrong with my script?
tell application "Finder"
set theFile to item 1 of (get selection) as text
end tell
tell application "System Events"
set volumeName to volume of file theFile
set serverName to server of disk volumeName
if format of disk volumeName is AppleShare format and serverName is not missing value then
set filePath to POSIX path of file theFile
set afpPath to "afp://" & serverName & ".local/" & text 10 thru -1 of filePath
display dialog afpPath
else
display dialog "file " & theFile & " is not on a shared volume"
end if
end tell
But when I test the link out and email it to myself, I get an error message saying there was a problem connecting to the NAS server. But I am connected otherwise and can access all the files on there. What is wrong with my script?