View Single Post
My Solution with thanks to DerekM of omni:
I have two additional columns in my outline, one called "obs" the other "completed". I wish to conduct two counts of my document. The first is all those items at the lowest level of the outline that are also flagged as an observable in the obs column with a number 1. I also wish to count the number of items that I have marked as completed by placing a number 1 in the completed column. I use the manual flags as other parts of my outline are general notes where the lowest items should not be counted. To use the code copy all the text below and paste into Script editor, hit compile and then run - don't forget to add the two numeric columns to your outline first.

enjoy Simon

tell front document of application "OmniOutliner Professional"
-- Based on the example posted by DerekM thanks Derek
-- set up some counter variables
set ObsCount to 0
set rowCounter to 0
set CompleteCounter to 0
repeat with oneRow in rows --onerow is the row being processed
set rowCounter to rowCounter + 1
if (exists child of oneRow) then
-- if the row has a child then do nothing
-- I'm interested in the lowest level of
-- the outline only
-- I have two columns called Obs and Complete
-- in my Outline. I place a 1 in the obs column
-- if I want the row to be included.
-- I place a 1 in the Completed Column for items that are
-- completed.
-- If I new how I'm sure that it would be possible
-- to count the tick boxes - DerekM are you there?
set IsObs to value of cell "Obs" of oneRow
set IsComplete to value of cell "Complete" of oneRow
if IsObs is 1 then
set ObsCount to ObsCount + 1
end if
if IsComplete is 1 then
set CompleteCounter to CompleteCounter + 1
end if
end if
end repeat
set itemsRemaining to ObsCount - CompleteCounter
-- Script reports total number of items to process,
-- the number of completed items and the number still
-- to do.
display dialog (((ObsCount as string) & " items to process. " & CompleteCounter as string) & " items completed, " & itemsRemaining as string) & " items to complete"
end tell