View Single Post
Another option is:

save MyDoc in HFSPath
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.