The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Omnifocus weekly report script.... Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
I use Omnifocus a lot, and the thing that bugged me about it (or i am just to dumb to figure out how to do it) is that it does not help me a lot answering snippet emails..... I could not find a good way to create a report that showed: this is what i did last week...

If there is such a way, please tell me :)

so i wrote the applescript below that walks over the omnifocus database and creates a bbedit text file with dates/titles/shortnotes looking like this:

"30/4/08 .NET Library work

30/4/08 Add solution file to VS 2005 setup

30/4/08 Add deleted detection code on the contact object..

30/4/08 Add email constructor for primary and rel

30/4/08 Verify that the Contacts template is part of the setup

30/4/08 64 bit patch
Re: GData.NET for Windows x64

30/4/08 Released 1.1.4.1 Maintainance release
Added PrimaryEmail, PrimaryPostalAddress, PrimaryPhonenumber and PrimaryIMAddres
"

Note this is the first applescript i ever wrote, so if you think it can use improvements, let me know :) always eager to learn - i found getting into applescript not that easy...

If you want to use this without BBEdit, all you have to do is change the method BBEditOutput to use another application.


global theDate
global targetDate

set theDate to current date
set targetDate to theDate - 7 * days

tell application "OmniFocus" to activate

tell front document of application "OmniFocus"
set alertReply to display alert "Ready to generate outline" message "This process could take several minutes, during which OmniFocus and BBEdit will be unavailable for other tasks." as warning buttons {"OK", "Cancel"} default button "Cancel"
if (button returned of alertReply is "Cancel") then return
set topLevelProjectsAndFolders to every section
end tell

tell application "BBEdit"
activate
make new document
end tell

createReport(topLevelProjectsAndFolders)

on createReport(theProjects)
if (theProjects is {}) then return
createLine(item 1 of theProjects)
createReport(rest of theProjects)
end createReport

on createLine(anItem)
BBEditOutput(anItem)
createChildren(anItem)
end createLine

on BBEditOutput(anItem)
local rowData, nextLine, n
set rowData to getRowData from anItem
if (rowData is not {}) then
tell front window of application "BBEdit"
set sd to short date string of (rowDate of rowData)
set nextLine to sd & " " & (rowTopic of rowData) & return as Unicode text
select insertion point after last character
set selection to nextLine
try
set maxLength to 80
set n to (rowNote of rowData) as Unicode text
if (length of n > maxLength) then
set n to characters 1 thru maxLength of n
end if
if (length of n > 1) then
set n to " " & n & return
select insertion point after last character
set selection to n
end if
-- insert a blank
select insertion point after last character
set selection to return


on error
-- ignore error, there might not be a note, or it's to short
end try
end tell
end if
end BBEditOutput



on getRowData from anItem
using terms from application "OmniFocus"
set theModification to modification date of anItem
set theTopic to name of anItem
set theNote to (note of anItem)
end using terms from

if (theModification > targetDate) then
return {rowTopic:theTopic, rowNote:theNote, rowDate:theModification}
else
return {}

end if
end getRowData


-- anItem is an OF folder, project, or action
-- aRow is an OmniOutliner row
on createChildren(anItem)
using terms from application "OmniFocus"
try
-- First see if anItem is a folder
set itemChildren to every section of anItem
on error
-- Error says anItem isn't a folder, so see if it is a project
try
set anItem to root task of anItem
on error
-- Error says anItem isn't a project, so it must be a task
end try
set itemChildren to every task of anItem
end try
end using terms from
createChildrenHelper(itemChildren)
end createChildren

-- itemChildren is a list of OF folders, projects, and actions
-- aRow is an OmniOutliner row
on createChildrenHelper(itemChildren)
if (itemChildren is {}) then return
set childItem to item 1 of itemChildren
BBEditOutput(childItem)
createChildren(childItem)
createChildrenHelper(rest of itemChildren)
end createChildrenHelper
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
OmniFocus 2.0 Progress Report Nigrini OmniFocus 1 for Mac 58 2013-01-06 12:03 PM
Take Export from OmniSync for Omnifocus and create report? JonSingh OmniFocus Extras 0 2012-08-06 03:02 PM
Trying to create a weekly report Finlay Boo OmniFocus Extras 8 2012-04-26 01:50 AM
Extracting/Exporting for SIMPLE Weekly Report egrFocused Applying OmniFocus 0 2010-11-01 08:24 AM
Omnifocus report template for iWork Numbers '09? signal15 OmniFocus 1 for Mac 1 2009-04-21 01:59 PM


All times are GMT -8. The time now is 07:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2023, vBulletin Solutions, Inc.