I have one or many files and/or folders selected in the Finder. I manually copy them to the clipboard/pasteboard (⌘C).
To keep things simple, let's say I just copied one single normal file. The ideal solution, however, would deal with many files and a mixed selection with folders, aliases.
Now that this file is on the clipboard, I want to get its full path (preferably the POSIX path).
To save you time:
What I know so far (noted in rb-appscript):
OSAX.osax.the_clipboard
has a string of file names without path.Appscript.app('Finder').clipboard.get
is apparently not implemented (dictionary says "NOT AVAILABLE YET"; calling it returns :missing_value
.The following AppleScript seems to do the trick:
POSIX path of (the clipboard as «class furl»)
If there are multiple items on the clipboard, it will return the POSIX path of the first item only.
Also see the AppleScript command reference for the command the clipboard
.
rb-appscript version:
OSAX.osax.the_clipboard(:result_type => :file_url).path