Created
September 11, 2013 22:56
-
-
Save kitschpatrol/6530918 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 | |
try | |
tell application "Finder" | |
set selectedItem to (POSIX path of (the selection as alias)) | |
set the clipboard to selectedItem | |
end tell | |
on error | |
try | |
tell application "Finder" | |
set currentPath to (POSIX path of (target of front window as alias)) | |
set the clipboard to currentPath | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment