applescript export

Jean-Claude Wippler jcw at equi4.com
Mon Jun 6 02:13:23 PDT 2005


John DeSoi wrote:

> Below is what I'm using to do a text export of my entire document  
> so I can process it with DocBook. I'm not very familiar with  
> AppleScript, so maybe there is a better way to do it. But hopefully  
> it will get you started.
[...]
>     -- note: you get an error if you try to use a different  
> extension from .txt with this
>     save doc as "NSStringPboardType" in (POSIX path of thePath) &  
> ".txt"
>     -- use this for plain text, fixed width
>     -- save doc as "OONeatoStringPboardType" in (POSIX path of  
> thePath) & ".txt"

Thank you, that did the trick.

I'm maintaining the docs for an application I'm developing in OO3,  
because it can export to three formats which together suit me  
perfectly: plain text fixed width (used as README, with the doc  
section at the end collapsed), Dynamic HTML (for online docs, almost  
completely collapsed initially, and PDF (to become the complete  
manual, fully expanded).

Since I need to re-export frequently, every bit of automation helps.   
So far, I've got:

tell application "OmniOutliner Professional"
     tell front document
         expandAll
         repeat with c in children of last child
             set expanded of c to false
         end repeat
         -- courtesy John DeSoi, OOL-users mailing list, June 6 2005
         export to "/Users/jcw/Desktop/readme.txt" as  
"OONeatoStringPboardType"
         collapseAll
         set expanded of last child to true
         --export to "/Users/jcw/Desktop/docs.html" as "HTML (Dynamic)"
     end tell
end tell

The HTML export appears to be tricky, since it's a plug-in, not a  
built-in format, so the above attempt failed.  What the above does at  
least is collapse/expand the outline in just the right way to  
manually export to HTML.

The third format is PDF, but it looks like right now this can't be  
automated because of the need to adjust the "OmniOutliner Pro"  
preferences in the Print dialog followed by a "Save as PDF...". It's  
a bit unfortunate because these printer preferences don't seem to  
"stick".

Thanks again for your quick and effective help.

-jcw




More information about the OmniOutliner-Users mailing list