applescript export

John DeSoi desoi at pgedit.com
Sun Jun 5 18:22:26 PDT 2005


On Jun 5, 2005, at 8:25 PM, Jean-Claude Wippler wrote:

> Is there a way to export to plain text fixed width from AppleScript?
> Or any other format other than native, for that matter.
>
> Have searched the mailing list archives, but did not find an answer.

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.


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



tell application "OmniOutliner"
	set doc to front document
	set currentDoc to path of doc
	-- save and expand stuff because export only exports expanded
	save doc
	expandAll doc
	set thePath to path of doc
	if thePath ends with ".oo3" then
		set thePath to (characters 1 thru ((length of thePath) - 4) of 
thePath) as string
	end if
	-- 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"
	close doc
	open (POSIX path of currentDoc)
end tell




More information about the OmniOutliner-Users mailing list