Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Put a file's path on the clipboard via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Put a file's path on the clipboard via AppleScript
Authored by: Carl Stawicki on Apr 20, '07 07:41:03AM
I made this script to copy the path of an item selected in the Finder to the clipboard. It it useful for adding the item's path to a script or email. It gives the choice of getting the alias or posix paths. To use it, select the item in the Finder and run the script. Select which path you want copied to the clipboard. It is especially handy to place the script into your window toolbar.
tell application "Finder"
	activate
	set thisFile to selection as alias
	set theChoice to button returned of (display dialog "Alias Path or Posix Path for " & return & return & ((name of thisFile) as text) & "?" buttons {"Posix", "Alias"} default button 2 with icon note)
	if theChoice = "Posix" then
		set the clipboard to (POSIX path of thisFile) as text
	else
		set the clipboard to "alias \"" & (thisFile as text) & "\"" as text
	end if
	beep
end tell
Carl.

[ Reply to This | # ]