How can I place the path of the current Finder window on the clipboard?

By Alvin J. Alexander, devdaily.com

Question: How can I get access to the full path of the current Finder window? That is, when I'm looking at a Finder window in a directory like /Users/Al/Foo/Bar, how can I easily put that directory path on the clipboard so I can use it in other applications?

As a Mac OS/X newbie I couldn't find a good way to do this, so I wrote an AppleScript (script) to do it for me. Here is the script:

tell application "Finder"
    set theWin to window 1
    set thePath to (POSIX path of (target of theWin as alias))
    display dialog thePath buttons {"Clipboard", "OK"} default button 2
    if the button returned of the result is "Clipboard" then
        set the clipboard to thePath
    end if
end tell

I set up my system so I can run this command from the AppleScript menu (menulet), and it works very well.


devdaily logo