The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Determining file attachment types with AppleScript (http://forums.omnigroup.com/showthread.php?t=20480)

Kevin Yank 2011-03-23 04:45 AM

Determining file attachment types with AppleScript
 
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[/code]

Is getting the necessary information about the file attachment simply not possible with OmniFocus 1.8.2? That would make me very, very sad. :(

RobTrew 2011-03-23 09:55 AM

As in the [URL="http://forums.omnigroup.com/showthread.php?t=5100&page=2"]other thread[/URL]


All times are GMT -8. The time now is 10:09 PM.

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