Importing files, URL field and e-mail

I just took one of the included scripts and modified it so it would import a file from a watched folder into a particular group and then delete it. It works, except whatever PDF gets imported the “URL” field will contain the FROM e-mail address of whatever currently selected email I have in Mail. I have no reference to Mail anywhere…

on adding folder items to this_folder after receiving added_items
	try
		if (count of added_items) is greater than 0 then
			tell application id "DNtp"
				set theGroup to get record with uuid "7E2BA45F-1042-4B94-87EA-87CF02148AC4"
			end tell
			repeat with theItem in added_items
				try
					set thePath to theItem as text
					if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
						tell application id "DNtp"
							import thePath to theGroup
							set theRecord to thePath
							if exists theRecord then tell application "Finder" to delete theRecord
						end tell
					end if
				end try
			end repeat
		end if
	end try
end adding folder items to

You are dragging PDFs out of an email, correct?

Actually, no – I am dragging form a folder in the Finder. These PDFs /were/ originally likely printed from an e-mail – but I tested with the exact same PDF 2 or 3 times with a different email highlighted in Mail and it takes whatever is currently selected in Mail as the data for the URL field when I drag the file via the Finder.

Screencaptures of a changing value would help.

Further testing… I think this is a bug and I think I’ve narrowed it down. The problem only occurs when the “Content Creator” of the PDF is Mail but it has no “Where from” field set. This is the case when you print out of Mail to PDF (File -> Export as PDF).

If the PDF is not from Mail, it doesn’t seem to have an issue.

If the PDF is from Mail and has a Where from field set in the PDF, it seems to pull that into the DT URL field no problem.

I’ve attached before and after sceenshots and you can see the scenario of metadata I’m talking about in the info panel.

after:

Furthermore, this doesn’t happen when I drag the PDF directly into DT – only when using this script and a Folder Action.