Access to embedded attachment

Has anyone figured out how to access embedded attachments via AppleScript?

I have tasks with their Emails (*.eml) attached that I am trying to open the same way a double-click would open them - just using a keyboard shortcut instead.

Here’s what I’ve tried so far:

tell application "OmniFocus"
tell front window
	set curSel to selected trees of content
	set curTask to value of item 1 of curSel
	tell note of curTask
		set NumberOfFileAttached to number of file attachments
		set i to 1
		repeat while i ≤ NumberOfFileAttached
			set curFile to file name of file attachment i
			display notification curFile
			set i to i + 1
		end repeat
	end tell
end tell
end tell

The notification only show msng instead of the filename. I can see that OF default behaviour saves the file into /private/var/folders/.../com.omnigroup.OmniFocus2/and then opens it in the default application. The only thing I need to figure out is how to access the file name.

Thanks for your help!

Thomas

1 Like