Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EddyRespondek/9248057 to your computer and use it in GitHub Desktop.
Save EddyRespondek/9248057 to your computer and use it in GitHub Desktop.
on run {input, parameters}
set output to {}
repeat with f in input
set f to replace(POSIX path of f, "/Volumes/", "afp://myserver/")
set f to replace(f, " ", "%20")
set end of output to f
end repeat
set text item delimiters to linefeed
set the clipboard to (output as text)
end run
on replace(input, search, replace)
set text item delimiters to search
set ti to text items of input
set text item delimiters to replace
ti as text
end replace
@florianwestermann
Copy link

works well, thank you! quick question:

  • is there a way to add a prefix to the pasted clipboard text? like saying *dropbox-path:*
  • possible to remove the "start"-folders like /Users/Name/

@tloredo
Copy link

tloredo commented Mar 13, 2018

Thanks for this. In Automator, I selected Service receives selected [ files or folders ] in [ any application ], and it works fine with items selected in Path Finder as well as Finder. I needed the actual POSIX path, but with spaces escaped, so I used:

set f to replace(POSIX path of f, " ", "\\ ")

That gives paths that can be used at the command line (e.g., with ls).

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