If I select a file in the finder on my local or a remote server, I want the script to paste the POSIX path to the clipboard as text, for pasting in a chat window, etc.
This is what I have so far but it is not very clean:
on run
tell application "Finder"
copy selection to theSelected
set outputPathList to {}
set anItem to theSelected
copy (POSIX path of (anItem as alias)) to end of outputPathList
set AppleScript's text item delimiters to return
set outputString to outputPathList as string
set AppleScript's text item delimiters to ""
set the clipboard to outputString
end tell
end run
Any ideas on how to clean this up?