The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Determining file attachment types with AppleScript Thread Tools Search this Thread Display Modes
When using AppleScript to access and save out file attachments embedded in the note of an OmniFocus task, you need to specify the type (or filename extension) of the file to save, but as far as I can tell there is no way of identifying the type of a file attachment.

Based on what Iím seeing, when accessing embedded file attachments, you canít obtain the attachmentís filename. All you have access to is the file attachment object, which responds to the 'save' command, which requires you to specify a new filename.

I have a file attachment export AppleScript almost working. The only problem left is that it saves the files with no type, and therefore Mac OS X doesnít know what to make of them.

tell note of theTask
	set NumberOfFileAttached to number of file attachment
	set i to 1
	set ListOfPaths to {}
	repeat while i ≤ NumberOfFileAttached
		if file attachment i is embedded then
			set tempFilePath to my pathForTemporaryFile("OmniFocus")
			tell file attachment i
				save in tempFilePath
			end tell
			set end of ListOfPaths to tempFilePath
			set end of ListOfPaths to file name of file attachment i as string
		end if
		set i to i + 1
	end repeat
end tell
Is getting the necessary information about the file attachment simply not possible with OmniFocus 1.8.2? That would make me very, very sad. :(

Last edited by Kevin Yank; 2011-03-23 at 05:50 AM..
As in the other thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an attachment to a task created with AppleScript via Hazel HirnHorn AppleScripting Omni Apps 0 2013-03-06 12:54 AM
File Attachment ckeseling OmniPlan General 4 2010-06-18 12:15 AM
MS mail servers not accepting omni file as attachment John_P OmniOutliner 3 for Mac 5 2009-06-12 09:08 AM
OmniOutliner File Attachment Issue Cypher OmniOutliner 3 for Mac 2 2008-01-07 04:47 AM

All times are GMT -8. The time now is 01:22 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2023, vBulletin Solutions, Inc.