![]() |
How to get a count?
I have a document which boils down to a list of tasks. I would like to get a count of these lowest levels but they are not all at the same outline level. I have added a count column and placed a figure one against each item that should be counted but the totals option fails because the items are not all at the same level. Does anyone have a script that would generate the count? Thanks
Simon |
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 else -- 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 |
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 else (*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. 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 |
All times are GMT -8. The time now is 12:23 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.