-- csipttc_unisiwc_ctpttfwttc.app -- Copy Selected Items Path To The Clipboard Unless Nothing Is Selected In Which Case Copy The Path To The Foremost Window To The Clipboard on makeAndCopyLinkFromPath(myPath) if myPath starts with "/Volumes/" then set dirStructure to ((characters 9 thru -1 of myPath) as string) set strHTML to quoted form of ("" & myPath & "") --double :: bc otherwise it disappears? --tell application "Finder" to display dialog strHTML do shell script "echo " & strHTML & " | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf" else try tell application "Finder" set fileName to (POSIX path of (the selection as alias)) set filePath to URL of (the selection as alias) set strHTML to quoted form of ("" & fileName & "") --double :: bc otherwise it disappears? --tell application "Finder" to display dialog strHTML do shell script "echo " & strHTML & " | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf" end tell on error display dialog "Unable to copy a path to the clipboard. Make sure Finder is referencing a directory/folder within the file system." buttons {"Ok"} with icon caution with title "Error" end try end if end makeAndCopyLinkFromPath try tell application "Finder" set selectedItem to (POSIX path of (the selection as alias)) my makeAndCopyLinkFromPath(selectedItem) end tell on error try tell application "Finder" set selectedItem to (POSIX path of (target of front window as alias)) my makeAndCopyLinkFromPath(selectedItem) end tell on error display dialog "Unable to copy a path to the clipboard. Make sure Finder is referencing a directory/folder within the file system." buttons {"Ok"} with icon caution with title "Error" end try end try