Skip to content

Instantly share code, notes, and snippets.

@LeoHe09
Created November 30, 2014 03:26
Show Gist options
  • Save LeoHe09/696f264b957ea44ab002 to your computer and use it in GitHub Desktop.
Save LeoHe09/696f264b957ea44ab002 to your computer and use it in GitHub Desktop.
tell application "Finder"
set sel to the selection
if (count of sel) is greater than 1 then
set theList to ""
repeat with e in sel
set theList to theList & POSIX path of (e as text) & return
end repeat
set the clipboard to theList
else if (count of sel) is equal to 1 then
set the clipboard to POSIX path of (sel as text)
else
set the clipboard to POSIX path of (target of window 1 as alias)
end if
end tell
@phlllpp
Copy link

phlllpp commented May 4, 2020

Hello LeoHe09,
I found your script here and was super grateful as it's exactly what I was looking for. thanks!
one small question though: I've been trying to remove a certain part of the output string. the top folder names.
but can't get it working. was trying this function ..
can you help? thanks a lot :)

on findAndReplaceInText(theText, theSearchString, theReplacementString)
set AppleScript's text item delimiters to theSearchString
set theTextItems to every text item of theText
set AppleScript's text item delimiters to theReplacementString
set theText to theTextItems as string
set AppleScript's text item delimiters to ""
return theText
end findAndReplaceInText

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment