View Single Post
Version two now uses two columns of type checkbox to control the count.

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
The columns obs and complete should be of type checked *)

-- This is where the column names are refered to:
set IsObs to value of cell "Obs" of oneRow
set IsComplete to value of cell "complete" of oneRow

if IsObs is "checked" then
-- increment the counter
set ObsCount to ObsCount + 1
end if
if IsComplete is "checked" then
--increment the counter
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