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.

Code:
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
		else
			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 04: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-05 11:54 PM
File Attachment ckeseling OmniPlan General 4 2010-06-17 11:15 PM
MS mail servers not accepting omni file as attachment John_P OmniOutliner 3 for Mac 5 2009-06-12 08:08 AM
OmniOutliner File Attachment Issue Cypher OmniOutliner 3 for Mac 2 2008-01-07 03:47 AM


All times are GMT -8. The time now is 04:40 AM.


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