View Single Post
I’ve created an applescript to bulk export Omnioutliner files which I'll post when I'm finished and it’s working great but I just can’t seem to figure out how to specify the export file format. Here’s the excerpt from the OO applescript dictionary:

Code:
export specifier : the object for the command
   to file : Where to place the exported document.
   [as text] : The name of a writable file type to use when writing the document. Defaults to the appropriate type for the path extension on the export destination.
However, everything I’ve tried gives an error message "However, no matter what I've tried I always get an error like "OmniOutliner got an error: "HTML" is not a writable file type." no matter what I put after the "as" command:

Code:
set outputPath to POSIX file ("/Users/mmarotta/Google Drive/Outliner iphone copies/" & theName & ".html")
	
	tell application "OmniOutliner"
		tell front document
			export to outputPath as "HTML"
			close
		end tell
	end tell
The only thing that works is if I don’t use “as” at all and make the extension “.rtf” in the file name section but that only allows me to export rtf’s. No other extensions work.

Code:
set outputPath to POSIX file ("/Users/mmarotta/Google Drive/Outliner iphone copies/" & theName & ".rtf")
	
	tell application "OmniOutliner"
		tell front document
			export to outputPath
			close
		end tell
	end tell
I've tried everything I could think of after the "as" command, "HTML" "HTML (Dynamic)" ".html" "Microsoft Word Document" "docx" ".docx" I've tried removing the quotes, putting parentheses around it, adding brackets around the 'as' command as shown in the dictionary but none of it seems to work (and I always made sure to have the matching file extension in the output name). Even RTF which I know works without the "as" specifier stops working when I add "as rtf" using any of the above variations.

I must be missing something, how am I supposed to use the "as" command to specify what export file format for OO to use?