Attaching or linking emails

Trevor Harmon trevor at vocaro.com
Wed Apr 5 02:29:59 PDT 2006


On Mar 27, 2006, at 5:46 PM, Kai von Fintel wrote:

> I assume that more fancy scripts would do the
> insertion into OO3. If anyone develops such a thing (in particular for
> interaction between Mail and kGTD), please post it here.

I've combined your script with David's to create a new one that has  
the features of both. It automatically inserts the currently selected  
email into OmniOutliner. The comment field of the current  
OmniOutliner row gets replaced with a direct link to the email. For  
me it's the best thing for this task so far, but it's still not quite  
good enough, so any improvements upon this would be welcome. (For  
instance, it would be nice if the email attachment's label was the  
subject of the email instead of its filename.)

But the biggest problem is not with the script but with Mail.  
Clicking the link to the email opens it in a new window, but it's  
just the email by itself. It doesn't show the context of the message  
(that is, the follow-ups, the thread). Anybody know a way around this?

Trevor



tell application "Mail"
	
	set theSel to selection
	
	if the (count of the selection) is 1 then
		
		-- Get the selected message's filename
		
		set theMsg to item 1 of theSel
		set msgID to id of theMsg
		
		set theScript to "mdfind -onlyin ~/Library/Mail  " & quote &  
"kMDItemFSName == " & msgID & ".emlx" & quote
		set theMsgFile to do shell script theScript
		set theMsgFile to "file://" & theMsgFile
		
		-- Insert the filename into the OmniOutliner row
		
		tell application "OmniOutliner Professional"
			tell front document
				set targetRow to selected row 1
				tell targetRow
					set value of cell 1 to theMsgFile
				end tell
			end tell
		end tell
		
	else
		
		display alert "You must select a single message before running this  
script."
		
	end if
	
end tell



More information about the OmniOutliner-Users mailing list