Skip to content

Instantly share code, notes, and snippets.

@brainsatwork
Created April 13, 2011 21:32
Show Gist options
  • Save brainsatwork/918469 to your computer and use it in GitHub Desktop.
Save brainsatwork/918469 to your computer and use it in GitHub Desktop.
applescript which copies current Finder path to clipboard.
-- click on icon
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
my finderErrorMsg()
end try
-- drop folder on icon
on open {droppedFolder}
try
tell application "Finder"
set the currentPath to (POSIX path of droppedFolder as text)
set the clipboard to currentPath
end tell
on error
my finderErrorMsg
end try
end open
-- error message
on finderErrorMsg()
display dialog "Unable to copy path."
buttons("Ok")
end finderErrorMsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment