Getting started with scripting

Greg Titus greg at omnigroup.com
Fri Jan 25 01:25:59 PST 2002


On Thursday, January 24, 2002, at 09:57  PM, Daniel Brogan wrote:

> It's been a while since I've done any AppleScripting. Can anyone tell 
> me if
> the following is possible, and, if possible, help me get started?
>
> I'd like to write a script that will select all of the checked items in 
> my
> to do list, gather them under a headline with the current date, and then
> move them to a separate completed items outline. The resulting outline 
> will
> give me a diary of what got done when.
>

Hi Dan,

The following will do pretty much what you are asking for. I'm 
revisiting the AppleScript support for the eventual OmniOutliner 2.0 
right now, so if you (or anyone else) has any suggestions for 
terminology, or things you'd like to be able to do with Outliner and 
AppleScript, or even ideas for scripts that you'd like to be included as 
examples (like this one - this is a great idea!), I'd love to hear about 
them.

tell application "OmniOutliner"
	-- set up some variables
	set original to front document
	set diary to document named "Diary.ooutline"
	set today to current date

	-- format today's date in an appropriate way
	set dateString to month of today & " " & day of today & ", " & year 
of today as string
	
	-- create the entry in the diary
	make new item at end of items of diary with properties 
{text:dateString}
	
	-- move the checked items
	move (every item of original whose state is "checked") to end of 
children of last item of diary
end tell

This could be fleshed out quite a bit more (for example, if your diary 
isn't already open, finding it and opening the document for you), but 
it's a good minimal script to do what you need.

Hope this helps,
	--Greg




More information about the OmniOutliner-Users mailing list