Getting Emails into Tinderbox


(Simon Smailus) #1

I use TB to manage projects and tasks. Much of the information I receive comes via email. What is the best way to get emails into TB?

Mark A helped me script an agent that would convert much of an email into attributes from an email that had been exported from Mail to RTF, but I’m finding increasingly that RTF’s created by mail cause TB to crash.

I do have DTPO and Evernote. However, as it stands dragging in an email or Evernote note into TB gives me a note with a link, which is useful, but nothing else. However, I need the content of the email as well. My workflow at the moment is to save the email to DTPO convert to RTF and drag into TB.

This contains a little too much friction for each email.

Are there better solutions? It would be wonderful to be able to drag in an eml and have it create a note with content. Of course attachments are issues.


(Paul Walters) #2

DEVONthink’s “convert” commands can operate on multiple selected .eml messages – so no need to convert one-by-one. And after the conversion all the results are selected automatically and dragged as block into Tinderbox – from which individual notes are created. So, the “friction” of importing / converting / dragging a single email file is only different by a small increment from than the effort to import / convert /drag 10 or 20 or more emails.

DEVONthink as the intermediate has the additional advantage of offering conversion to formatted notes (a type of HTML file) or plain text – which can reduce the RTF burden.


(Simon Smailus) #3

Thanks for the reply Paul. Does the “Formatted” note format play better with TB than the RTF/D? I may have to see if I can create a Keyboard Maestro workflow to copy the emails to DTPO, convert and then straight to TB.


(Paul Walters) #4

A “formatted note” in DEVONthink is HTML and Tinderbox reads it as such. I don’t know if that “plays better” – the answer depends on the content of your own email. You would need to do a local analysis.


(Andreas Grimm) #5

How to get creationDate - i.e. the day an eMail was received - into TB?

Drag-dropping eMails into DTPO will populate the “created” attributed with the day the eMail was received.

But drag-dropping the eMail from either Mail.app or DTPO to TB will not bring over this created/reception day info.

I’m certain that this is possible and I am only missing something.

Help appreciated


(eastgate) #6

I’d paste the date into an editable date attribute such as $StartDate.

At present, I believe an action can set $Created but that’s not a terrific idea and may not work indefinitely.


(Simon Knight) #7

Hi, I have just returned to Tinderbox and this action is of interest which is why I’m bumping it to the front.

I have an Applescript that reads and processes the selected email in Apple Mail. My script then creates a new record/note in an OmniOutliner Document but there is no reason why it should not write the data to a textedit document or even the clipboard for importing into Tinderbox.

It would be good to be able to use Applescript to create a new note directly but in version 6.3 there does not seem to be any Applescript judging by the fact that Script Debugger is unable to find a dictionary.

Please let me know if this is of interest.

Simon


(Paul Walters) #8

You might want to update to Tinderbox 7, which has numerous new features.

Tinderbox is not scriptable, but plays well with clipped and pasted rich or plain text information from the clipboard.

  • Your Mail --> OmniOutliner script can be useful if you export the data from OO5 (or previous OO releases) as OPML and drag that into Tinderbox.
  • You can drag messages from Mail --> Tinderbox and get a workable text-only import.
  • My personal preference is to set up an auto-export rule in Mail to put messages into DEVONthink, where a triggered script converts the messages to rich text. I then watch that DEVONthink group with Tinderbox 7’s “watched” feature that can monitor the contents of DEVONthink group, and imports the rich text versions of the mail. Tasks a few minutes to set up the end-to-end process but then it ticks along like clockwork.

(Simon Knight) #9

Hi Paul,
Thanks for your reply. Mark B has already suggested that I should upgrade to the latest version and I am warming to the idea. I’ve tried the simple drag and drop into v6.3 but it creates a note with just the title of the email. I guess things may have improved in later versions of Tinderbox.

I’m trying to avoid having to purchase yet more software such as DevonThink but will bear your recommendations in mind.

I’ll report back once I have beaten my Applescript into shape - at present its creating a new note for every line in the email.

best wishes
Simon


(Paul Walters) #10

Another option, should you get Tinderbox 7, is to merely use Mail > File > Save As… and save the email as Rich Text to a folder on Desktop or wherever. Tinderbox 7 can watch that folder and import the exported Rich Text files. Or save the files as PDF and do the same.


(Simon Smailus) #11

I’ve not done this in a while, and so it may now not be the case, but the reason for this thread at the time was that rtfs created in this way where causing TB to crash.


(Paul Walters) #12

There’ve been numerous releases over the past 20 months, so perhaps that’s why I never have that issue.


(eastgate) #13

No reports of RTF crashes on import anytime in the recent past. A long time ago, problems could arise with tables wider than than text window allowed.


(Simon Smailus) #14

That’s really great! Thanks guys.


(Simon Knight) #15

Well, it was an interesting exercise converting my Applescript see below. The script will process a number of emails selected in Apple Mail and copy the details to the clipboard. These can then be pasted into Tinderbox. See the comments in the script. You need to define a prototype and ensure that the date field/attribute is given a type of string.

Use at your own risk.

best wishes
Simon K.

Blockquote
(*
A script that parses a number of emails that have been selected in Apple’s Mail application.
Certain key data are extracted and saved to variables.
The body of the email is cleaned of tabs and linefeeds with
linefeed replaced with UTF-8 line separator character (8232)
The lines of data are copied to the clipboard ready to be
pasted into Tinderbox.
Note create a prototype note named protoEmail and give it
an attribute named DateSent of type string. If you don’t then
Tinderbox will give it type date and display an incorrect date.

written by Simon Knight August 2018, Use at own risk!
*)
– First Copy the data in the email to variables
tell application “Mail”
– get all the messages in the list with same subject
set tMessageList to selection
set tEmail to “”
set tdata to “”
set tline to “”
–set x to 1 – Originally I grabbed all the emails in the selection in a repeat loop
repeat with x from 1 to (count tMessageList)
–From:
set tSender to the sender of (item x) of tMessageList
–Subject:
set tSubject to the subject of (item x) of tMessageList
–Date:
set tDateSent to the date sent of (item x) of tMessageList
–To:
set tRecipients to the recipients of (item x) of tMessageList

	set tAddresseeList to ""
	repeat with n from 1 to (count tRecipients)
		set tAddressee to (item n) of tRecipients
		set tAddresseeList to tAddresseeList & address of tAddressee & " / "
	end repeat --list of recipients
	
	-- Message Body
	set tContent to the content of (item x) of tMessageList
	set tFind to linefeed
	set tReplace to character id 8232
	set tBodyText to CleanText(tFind, tReplace, tContent) of me
	set tFind to tab
	set tReplace to "---"
	set tBodyText to CleanText(tFind, tReplace, tBodyText) of me
	set tFind to character id 13
	set tReplace to character id 8232
	set tBodyText to CleanText(tFind, tReplace, tBodyText) of me
	-- build a line for output
	set tline to tSubject & tab & tBodyText & tab & tSender & tab & tDateSent & tab & tAddresseeList & tab & "protoEmail"
	set tdata to tdata & linefeed & tline
end repeat -- list of selected messages

end tell – Apple Mail

– build header row
set tHeaders to “Name” & tab & “Text” & tab & “From” & tab & “DateSent” & tab & “Addressees” & tab & “Prototype”
set tExport to tHeaders & tdata

–set the clipboard to tExport
set the clipboard to tExport as «class utf8»

– uncomment the following lines if you wish a text file saved to the desktop, delete the “(" and ")”
(*
set outputFile to ((path to desktop as text) & “SelectedEmails.txt”)
try
set fileReference to open for access file outputFile with write permission
–write tBodyText to fileReference without altering line endings
write tExport to fileReference as «class utf8»
close access fileReference
on error
try
close access file outputFile
end try
end try
*)
beep

on CleanText(pFind, pReplace, pText)
– save the existing delimiters
set prevTIDs to text item delimiters

-- find the newline hex 0A characters
set text item delimiters to pFind
set tText to text items of pText

-- add the replacement character / string
set text item delimiters to pReplace
set tText to tText as text

-- resset the delimiters back to how they were
set text item delimiters to prevTIDs

return tText

end CleanText