Archive for October, 2006

links for 2006-10-31 - auto-posted

Automatically posted by del.icio.us.

  • A guide for election night (Nov. 7, 2006) on the races to be watching as the polls close.

links for 2006-10-30

Scripting OmniOutliner Pro

After a few hours of effort, I’ve finally gotten a script I designed to work with OmniOutliner Pro. The concept of it is to have a “tags” column, where I can input keywords to search for, in my history notes document in order to extract information about specific tags. I organize my notes in terms of class & reading notes, so I needed to do something about separating them out when running the script. As well, I didn’t want it to break when running multiple searches in succession without removing the previous results. My final script (for now) is this:

tell front document of application “OmniOutliner Professional”
unhoist
expandAll

set theCategories to {”Class Notes”, “Reading Notes”}

set theTag to the text returned of (display dialog “Enter the tag to find:” default answer “”)

set theRows to (every row whose (third cell’s text contains theTag))

repeat with theHeading in theCategories

set theAncestors to (every row whose (level is 1) and (topic is not theHeading))

set theAffectedRows to theRows & theAncestors
set theAffectedRows to expel descendants theAffectedRows

if (length of theAffectedRows is not (length of theAncestors)) then
set theAffectedRows to (items 1 thru -((length of theAncestors) + 1) of theAffectedRows)
else
set theAffectedRows to {}
end if

select {}
select theAffectedRows

set newRow to make new row at the end of rows
set topic of newRow to (theTag & ” - ” & theHeading)

if (theAffectedRows is not {}) then
copy selected rows to end of rows of newRow
end if

end repeat

end tell

I probably could clean it up a bit and make it more efficient, but it’s working, so until I want to add new features I’m not going to touch it.

I tried to get something like this to work:


set theAncestor to every row whose (level is 1) and (topic is theHeading)

set theRows to every row whose (third cell’s text contains theTag) and (ancestors contains theAncestor)

Unfortunately, that kept throwing errors and I couldn’t get it to work.

In the notes, each day’s notes are stored under their own row with the date under the respective top-level row (”Class Notes” or “Reading Notes”). My next step in the script is to have all of the notes in each top-level extracted section organized by date, but that’s going to be a much bigger pain, so I’ll hold off for a bit.