Quote:
Originally Posted by myfre
thanks. used Rob's quick stats script and compared the old backup as whpalmer suggested. they are the same.
|
You know, I thought to myself "he's not going to use OFQuickStats to compare them, is he? Not if I tell him to look..." when I wrote that post. Apparently, I was wrong :-)
OFQuickStats isn't the tool for the job, as it rummages around in the cache for the default document, and so will give identical answers even if the databases are completely different. It not only doesn't know which database you might be looking at, it doesn't even need OmniFocus to be running to do its work. Alas, it only works for the default document, not any that you've opened by double-clicking in the Finder.
If you want to do some counting and have it work for other than the default document, you might use this older script which isn't as fast:
Code:
-- Recursively counts projects, single-action lists, and folders of the front OmniFocus document. Written by Dennis Rande, 10/16/08. Additional modifications by Bill Palmer to permit use with other documents, count actions and zip files, etc.
global FolderRec
global ProjRec
global SALRec
set FolderRec to {numActive:0, numDropped:0, totalNum:0}
set ProjRec to {numActive:0, numOnHold:0, numCompleted:0, numDropped:0, totalNum:0}
set SALRec to {numActive:0, numOnHold:0, numCompleted:0, numDropped:0, totalNum:0}
tell application "OmniFocus"
if (front document is default document) then
set DoZipFileandActions to true
else
set DoZipFileandActions to false
end if
my GetStats(front document)
repeat with aFolder in every folder of front document
my GetStats(aFolder)
my RecursiveScan(aFolder)
end repeat
end tell
set output to ""
set output to output & "Active Folders: " & numActive of FolderRec & return
set output to output & "Dropped Folders: " & numDropped of FolderRec & return
set output to output & "Total Folders: " & totalNum of FolderRec & return & return
set output to output & "Active Projects: " & numActive of ProjRec & return
set output to output & "On Hold Projects: " & numOnHold of ProjRec & return
set output to output & "Completed Projects: " & numCompleted of ProjRec & return
set output to output & "Dropped Projects: " & numDropped of ProjRec & return
set output to output & "Total Projects: " & totalNum of ProjRec & return & return
set output to output & "Active Single-Action Lists: " & numActive of SALRec & return
set output to output & "On Hold Single-Action Lists: " & numOnHold of SALRec & return
set output to output & "Completed Single-Action Lists: " & numCompleted of SALRec & return
set output to output & "Dropped Single-Action Lists: " & numDropped of SALRec & return
set output to output & "Total Single-Action Lists: " & totalNum of SALRec & return & return
if (DoZipFileandActions) then
set TotalNumActions to do shell script "sqlite3 ~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2 'select count(*) from Task';"
set ZipFileCount to do shell script "ls -l ~/Library/Application\\ Support/OmniFocus/OmniFocus.ofocus | grep zip | wc -l | tr -d ' '"
set output to output & TotalNumActions & " actions in " & ZipFileCount & " zip files"
end if
display dialog output buttons {"Copy", "OK"} default button 2
if button returned of result is "Copy" then
set the clipboard to output
end if
on RecursiveScan(aFolder)
with timeout of 300 seconds
tell application "OmniFocus"
tell default document
repeat with subFolder in every folder of aFolder
my GetStats(subFolder)
my RecursiveScan(subFolder)
end repeat
end tell
end tell
end timeout
end RecursiveScan
on GetStats(aContainer)
tell application "OmniFocus"
tell default document
set FolderActiveCount to count of (folders whose hidden is false) of aContainer
set FolderDroppedCount to count of (folders whose hidden is true) of aContainer
set FolderTotalCount to count of folders of aContainer
set numActive of FolderRec to (numActive of FolderRec) + FolderActiveCount
set numDropped of FolderRec to (numDropped of FolderRec) + FolderDroppedCount
set totalNum of FolderRec to (totalNum of FolderRec) + FolderTotalCount
set SALActiveCount to count of (projects whose singleton action holder is true and status is active) of aContainer
set SALOnHoldCount to count of (projects whose singleton action holder is true and status is on hold) of aContainer
set SALCompletedCount to count of (projects whose singleton action holder is true and status is done) of aContainer
set SALDroppedCount to count of (projects whose singleton action holder is true and status is dropped) of aContainer
set SALTotalCount to count of (projects whose singleton action holder is true) of aContainer
set numActive of SALRec to (numActive of SALRec) + SALActiveCount
set numOnHold of SALRec to (numOnHold of SALRec) + SALOnHoldCount
set numCompleted of SALRec to (numCompleted of SALRec) + SALCompletedCount
set numDropped of SALRec to (numDropped of SALRec) + SALDroppedCount
set totalNum of SALRec to (totalNum of SALRec) + SALTotalCount
set ProjActiveCount to count of (projects whose singleton action holder is false and status is active) of aContainer
set ProjOnHoldCount to count of (projects whose singleton action holder is false and status is on hold) of aContainer
set ProjCompletedCount to count of (projects whose singleton action holder is false and status is done) of aContainer
set ProjDroppedCount to count of (projects whose singleton action holder is false and status is dropped) of aContainer
set ProjTotalCount to count of (projects whose singleton action holder is false) of aContainer
set numActive of ProjRec to (numActive of ProjRec) + ProjActiveCount
set numOnHold of ProjRec to (numOnHold of ProjRec) + ProjOnHoldCount
set numCompleted of ProjRec to (numCompleted of ProjRec) + ProjCompletedCount
set numDropped of ProjRec to (numDropped of ProjRec) + ProjDroppedCount
set totalNum of ProjRec to (totalNum of ProjRec) + ProjTotalCount
end tell
end tell
end GetStats