dragging file to dock icon to get posix path of file?

Hi,

I am just curious, is it possible to do this?

To set the contents of the clipboard to the posix path of a file that has been dragged to the app’s icon on the dock?

thanks in advance.

There are a ton of Contextual Menu items that will do this for you but here’s a quick way using AS alone. Save as an applet and put it in your Dock:

on run
	open {choose file}
	(*
	--or, to get the current Finder selection:
	tell application "Finder" to set the_selection to selection
	open the_selection
	*)
end run

on open the_selection
	repeat with i from 1 to (count the_selection)
		set item i of the_selection to POSIX path of ((item i of the_selection) as alias)
	end repeat
	tell (a reference to my text item delimiters)
		set {old_delims, contents} to {contents, return}
		set {the_selection, contents} to {the_selection as Unicode text, old_delims}
	end tell
	set the clipboard to the_selection
end open

Jon

thanks jon,

That script works great! Thanks so much!