Path to file.

How do I get the path to a selected file in Finder. I have searched but the search is too broad for this topic.

Hi,

If one file is selected in Finder, try something like:

tell application "Finder"
	get selection as text
end tell

If multiple items are selected:

tell application "Finder"
	get selection as list
end tell

This returns a list of references to the files/folders/packages selected. You could then iterate through those to find the ones you are interested in.

This would give the path to the first selected item (if at least one is selected):

tell application "Finder"
	set myItems to (get selection as list)
	set myPath to (item 1 of myItems) as text
end tell

Best wishes

John M