Drop email to ListBox

Does anyone know, how can I drag and drop an email from apple mail directly into a Listbox? When I drag an email to a folder location, OS X makes a .elm file on the dropped folder location. I would have the same function with a listbox. Drop an email from apple mail to a listbox and the dojo application copy this email as an .elm file to another folder location.

have you read DragItem, ListBox (DropObject Event) ?

Now, I am not sure that a ListBox is the answer to your question.

Do you want to get the text of the mail in a ListBox Cell ???

I do not. Maybe a TextArea will be better (some mails have styled text).

Note: I never tried to do what your question tell and worst, I never used Mail.
I hope these good sense answer will help.

The Listbox cell should have the email subject like <[New Reply] Drop email to ListBox.elm> and the complete email should be saved or copied to a folder. The same function, when you drop an email from apple mail to any folder. You get a new file called <[New Reply] Drop email to ListBox.eml>.

OK, so you will have a one column ListBox with the eMail Subject line of your mails as the Cell contents and export to disk the mail contents ?

So, you have to add the ListBox’ DropObject Event.
Then, in Obj As DragItem:

Add a string variable (to hold the mail contents: Obj.Text),
Add a FolderItem variable (to store the mail into file),
Search the contents of the Subject field,

Add a Row and place the subject field into it,

Create a Text File, use the subject field as the file name,
Store into that file the mail contents.

At that moment, you can store the Mail FolderItem in the CellTag for later use (in that session).

In later sessions, open the folder where you store the mails, and insert in the ListBox the name of the files found there (and do not foret to store in CellTag the FolderItem for each Mail text file.

I think I forgot something… Ah ! the read the mail part !
A click / selection in a Row loads the mail text and store its contents in a TextArea, using the FolderItem found in the CellTag.

Need more: “Just ask”.

Sorry, Listbox does not accept dropping an email. I have this in the open event
me.AcceptMacDataDrop “public.message”
me.AcceptMacDataDrop “public.plain-text”
me.AcceptMacDataDrop “public.mime-type”

Sorry Horst, I do not know how to get the drop contents / kind.

You certainly know, but instructions with File in them are useless here (me.AcceptFileDrop for example).
(I understand: you tried anything that comes to mind…)

I have a stupid idea (better than nothing):

select in Mail what you want to drag,
copy it in the Clipboard,
run Script Editor
copy / paste: return clipboard info

you will get something like:

{{«class utf8», 198}, {«class ut16», 398}, {string, 198}, {Unicode text, 396}}

(that was text copied from FireFox - remember I do not use mail, never run it).

In Safari, I selected a web page with styled text and images and that gives:

{{«class weba», 116421}, {«class rtfd», 95914}, {«class RTF », 11190}, {«class utf8», 1683}, {«class ut16», 3310}, {uniform styles, 18572}, {string, 1654}, {scrap styles, 2042}, {Unicode text, 3360}, {uniform styles, 18572}, {scrap styles, 2042}}
I hope this will goives you ideas to continue…

I have to leave internet now and be back tomorrow morning only.

I’ve done some tests
In Mail I have a email with the subject “testmail”

if I drag the email to the Finder I get a eml file (testmail.eml)

if I drag the email to TextEdit or to a Xojo TextArea I get a Link.