The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   Exporting to OPML using AppleScript (http://forums.omnigroup.com/showthread.php?t=160)

atobe 2006-04-19 02:06 PM

Exporting to OPML using AppleScript
 
Hi,

Can anyone help with this script, or am I going awry in my assumptions somewhere?

I want to export the frontmost document as an OPML file. I am using OmniOutliner 3.5 (v134.2) - do I need Pro? and Mac OS X 10.4.6 .

When I run the script I get NSInternalScriptError and no file :(

If I remove the [U]as "opml"[/U] part I get a new folder called [U]test[/U] that contains a document [U]content.xml[/U], which appears to be binary!

[CODE]tell application "OmniOutliner"
set thePath to (choose folder) as string
set opmlPath to thePath & "test.opml"
set posixPath to (POSIX path of opmlPath)
display dialog posixPath
export front document to posixPath as "opml"
end tell
[/CODE]
Any ideas?

Many thanks,
Toby

JamesM 2006-04-19 03:26 PM

Change that last line to
[CODE]
export front document to posixPath as "OOOPMLDocumentType"
[/CODE]

atobe 2006-04-19 03:59 PM

Thanks!
 
Works a treat!

Is there are reference for this stuff anywhere? Can I find it out from the AppleScript Dictionary?

Thanks again,
Toby

JamesM 2006-04-20 06:54 AM

There is an SDK available on our Extras page

<http://www.omnigroup.com/applications/omnioutliner/extras/>

I don't recall off-hand if those built-in document types are referenced there. If they aren't please email [email]omnioutliner@omnigroup.com[/email] and I'll file a bug.

Tim Wood 2006-04-21 01:58 PM

Another option is:

[code]save MyDoc in HFSPath[/code]

If HFSPath ends in ".opml", the saving code will use the OPML file format. You can override this using 'as' (important if there is more than one exporter for a given file type like HTML).

Sadly, the export command we have doesn't do this (since it was mostly written to support Automator -- which would be another option).

There is an application property "writable document types" that lists all the export type display names, file extensions and document types. The 'documentType' key in each record is what you'd pass for the 'as' argument in James' example.

zurisee 2008-05-30 02:11 AM

This looks useful, but I'd need a simple but executable example for

save MyDoc in HFSPath

(I'm new here and not familiar with "HFSPath" and the like)

Thanks,
Dieter


All times are GMT -8. The time now is 11:15 PM.

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