The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

New file via Applescript: do I have this right? Thread Tools Search this Thread Display Modes
It seems to be the case that if I use:

make new document

the resulting new document will not have the default style. OTOH, if I use System Events and have it click the New menu item, of course it does.

Is there really no way to create a new doc via applescript and have it use the default template? Why doesn't it anyway?

Relatedly, is there a way via applescript to make a doc load a particular set of styles from a template or another open file?
That does indeed appear to be the case. Creating a new file through applescript makes a completely bare file. I don't know why this is, perhaps so you always have the same starting point regardless of who is using the script. But there also doesn't appear to be a way to specify a template.

I believe it's possible to copy the styles from one document to another with AppleScript, I haven't looked at it in a while. There isn't a single command to do it though.
I ran into this last night actually. The solution is to open your default template instead of making a new document. Since OO recognizes that it's a template, opening it has the effect of creating new document.

-- Replace "Default.oo3template:" with your favored template.  Note the trailing colon, because the file is a bundle.
set template to alias ((path to application support from user domain as string) & "OmniOutliner 3:Templates:" & "Default.oo3template:")

tell application "OmniOutliner Professional"
   open template -- as opposed to "make new document"
   set newOutline to front document -- "open" doesn't return a reference to the new document like "make" does, so use this instead.
end tell

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
AppleScript: OF Project as OpenMeta file tag eurobubba OmniFocus Extras 8 2011-05-08 05:28 PM
Applescript for Attaching file to action dg005978 OmniFocus Extras 9 2011-03-16 07:50 PM
applescript to export to text file? jbaile38 OmniFocus Extras 3 2008-09-06 12:01 PM
Multiple file export via Applescript braindump OmniOutliner 3 for Mac 2 2008-01-12 04:27 PM
Using Applescript to Attach File BillB OmniOutliner 3 for Mac 1 2007-04-16 03:55 PM

All times are GMT -8. The time now is 07:38 AM.

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