Copy Finder Path to Clipboard – Tip 1

Thu, Mar 27

I” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A’)”ve written a short script that I” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A’)”ve found more useful that I ever anticipated. It is nothing more than an AppleScript application that copies the current path of Finder to the clipboard. Sounds rather unassuming, however, I think you” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A’)”ll be surprised how handy it is.

The AppleScript code is less than 10 lines that instruct Finder to get the path of the front most Finder window and copy the path to the clipboard.

 onclick= Click here to paste the code below into the Script Editor

try
  tell application " onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"Finder" onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"
    set currentPath to (POSIX path of (target of front window as alias))
    set the clipboard to currentPath
  end tell
on error
  display dialog " onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"Unable to copy a path to the clipboard.
                      Make sure Finder is referencing a directory/folder
                      within the file system." onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"
                      buttons {" onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"Ok" onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"} with icon caution with title " onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"Error" onclick="return TrackClick(" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"," onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')"applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A" onclick="return TrackClick('','applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A')")"
end try

From within Script Editor, save the code as an application and then drag/drop the application to the toolbar in Finder. The screenshot below shows the Script Editor icon in Finder (to the right of the terminal window with the green arrow), where it is now one click away.

There is a trivial amount of error handling in this short script. If you try and run this script while Finder is referencing the system (as compared to a directory/folder on the system) you” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A’)”ll get the following error message.

In the next tip of this series we” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A’)”ll drill down one level further and I” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3Dtry%250A%2509tell%2520application%2520%2522Finder%2522%250A%2509%2509set%2520currentPath%2520to%2520%2528POSIX%2520path%2520of%2520%2528target%2520of%2520front%2520window%2520as%2520alias%2529%2529%250A%2509%2509set%2520the%2520clipboard%2520to%2520currentPath%250A%2509end%2520tell%250Aon%2520error%250A%2509display%2520dialog%2520%2522Unable%2520to%2520copy%2520a%2520path%2520to%2520the%2520clipboard.%2520Make%2520sure%2520Finder%2520is%2520referencing%2520a%2520directory%252Ffolder%2520within%2520the%2520file%2520system.%2522%2520buttons%2520%257B%2522Ok%2522%257D%2520with%2520icon%2520caution%2520with%2520title%2520%2522Error%2522%250Aend%2520try%250A’)”ll show how to copy the path of a selected folder within the current Finder window, to the clipboard.

10 comments

Wow, that was simple. Thanks for the Apple script tutorial and thanks for bridging an Apple annoyance gap that I’ve had since forever.

by Matt Platte on Mar 28, 2008. Reply #

No problem, Matt, glad you found it helpful. Check out Tip #2 (the next post) that supports dragging and dropping a folder onto the script/icon…

by john on Mar 28, 2008. Reply #

Great! I´ve been looking for something like this. In Windows 2000 and newer one is able to copy/paste addresses in Explorer (the Windows-equivalent to Finder). I use that all the time and having to click around in OSX is extremely annoying. Somebody should make a whole archive of useful scripts like these. :)

by PC-Bjorn on Oct 2, 2008. Reply #

Fantastic – have recently been using the terminal window a lot (playing with MySQL & other command-line software) and this has solved a major annoyance. It was the one tiny area where I thought that Windows had won the battle for usability. I can’t imagine why Apple haven’t included this feature as standard. Thanks very much.

by Jen on Nov 17, 2008. Reply #

Jen, have you tried drag’n’dropping to the terminal window?

by Meth on Dec 11, 2008. Reply #

Question:
Great!

How to make it so I can automatically run the script without having the “Run Script” dialog pop up.

How do I customize the icon?

Thanks,
Patrick

by Patrick Lemiex on Jan 11, 2009. Reply #

Thanks very much, this is really very useful. Especially since I have been trying to copy directory paths using my tablet and there is a delay in selecting each individual folder hierarchy. I no longer envy pc copy and paste directory.

by Maria on Sep 22, 2009. Reply #

this is really helpful. Many thanks

by siti on Jan 19, 2010. Reply #

It’s really helpful. Thank you very much. I really appreciate it. This simple tweak can really make saving files process much more easier.

by Guntar on Oct 9, 2010. Reply #

That is really what I want! Thanks a lot!

I will try to learn more about AppleScript.

by Tong on Dec 3, 2011. Reply #

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>