Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rate Thread Display Modes
Old 02-12-2013, 01:19 PM   #1
robleach
Prospect
 
Join Date: Feb 2003
Posts: 31
Text Edit RTF Drag & Drop Question

Is there a modifier key that will allow me to drop a file into an RTF document open in text edit that will paste the file path instead of the file itself? I find it rather annoying that I must open an interim file that is plain text to drop a file there, copy its path, then paste it into the RTF document. I've tried every modifier key combo I can think of and cannot control the behavior of drag & drop into an RTF document.

Or perhaps someone knows of a service that will allow me to control-click on a file and select a menu item to copy its path...?

BTW, I'm running Lion, so I don't know if this is an issue that is solved in Mountain Lion.

Thanks,
Rob
robleach is offline   Reply With Quote
Old 02-12-2013, 01:30 PM   #2
NaOH
Hall of Famer
 
Join Date: Dec 2007
Posts: 3,649
Quote:
Originally Posted by robleach
BTW, I'm running Lion, so I don't know if this is an issue that is solved in Mountain Lion.

Calling it an issue implies something not behaving correctly. In this case, everything is working properly since RTFs have the ability to accept attachments.

Anyway, a script like the ones below will probably help. You could save either as an application for easy Dock access or you could use Automator to create a Service (and then, optionally, System Preferences > Keyboard to assign a keyboard shortcut).

Code:
tell application "Finder"
	activate
	set thisFile to selection as alias
	set theChoice to button returned of (display dialog "Get Alias Path or Posix Path for " & return & return & ((name of thisFile) as text) & "?" buttons {"Cancel", "Alias", "Posix"} default button 3)
	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
end tell
The one above provides a choice of which file path format will be placed on the clipboard, POSIX or Alias. The one below skips asking you for which kind of file path to place on the clipboard and gives you a POSIX path. I'm guessing the second will be more what you want, but you'll be able to decide for yourself.

Code:
tell application "Finder"
	try
		if exists front window then
			my copy_path((first item of (get selection as list)) as alias)
		end if
	end try
end tell

on open these_items
	my copy_path((first item of these_items) as alias)
end open

on copy_path(strPath)
	try
		set strPath to the POSIX path of strPath
	end try
end copy_path
NaOH is offline   Reply With Quote
Old 02-12-2013, 01:32 PM   #3
DeltaMac
League Commissioner
 
Join Date: Jan 2002
Posts: 7,998
You could use TexEdit/Edit menu/Add Link...
Drag your file into the box, and click OK.
That will paste the file's path into your document.

You can also use the shortcut "command-K" to open that Link Destination window directly.
DeltaMac is offline   Reply With Quote
Old 02-12-2013, 01:52 PM   #4
robleach
Prospect
 
Join Date: Feb 2003
Posts: 31
Quote:
Originally Posted by NaOH
Calling it an issue implies something not behaving correctly. In this case, everything is working properly since RTFs have the ability to accept attachments.

You're right of course. Thanks for the script.

Rob
robleach is offline   Reply With Quote
Reply

Tags
drag and drop, file path, lion, rtf, text edit

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 02:42 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.