coaching newsletter contact

DailyReport.applescript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
on hazelProcessFile(theFile)
  set filePath to "/Users/JoeBuhlig/Dropbox/Text/TaskReports/" -- Where to save the resulting text file (Be sure to add the trailing "/")

  -- Create the new filename as YYYYMMDD.txt
  set todayDate to current date
  set yestDate to todayDate - 1 * days
  set {year:y, month:m, day:d} to yestDate
  set fileName to y * 10000
  set fileName to fileName + (m * 100)
  set fileName to fileName + d

  -- Set the starting date of the report
  set startDate to todayDate - 1 * days
  set startDate's hours to 0
  set startDate's minutes to 0
  set startDate's seconds to 0

  -- Set the ending date of the report
  set endDate to todayDate - 1 * days
  set endDate's hours to 23
  set endDate's minutes to 59
  set endDate's seconds to 59

  -- Create the blank report to build from
  set reportText to ""

  tell application "OmniFocus"
    tell front document
      set theProjects to every flattened project where its modification date is greater than startDate and modification date is less than endDate
      repeat with a from 1 to length of theProjects
        set currentProj to item a of theProjects
        set theTasks to (every flattened task of currentProj where its completed = true and completion date is greater than startDate and completion date is less than endDate)
        if theTasks is not equal to {} then
          set reportText to reportText & return & return & "------------------------------" & return & name of currentProj & return
          repeat with b from 1 to length of theTasks
            set currentTask to item b of theTasks
            set completedDate to completion date of currentTask
            set completedTime to time string of completedDate
            set reportText to reportText & return & name of currentTask & " ----- " & completedTime
          end repeat
        end if
      end repeat
      if reportText is equal to "" then
        reportText = "Nothing completed for this day."
      end if
      set runTime to date string of (todayDate - 1 * days)
      set reportText to runTime & return & return & reportText
      set newFile to open for access filePath & fileName & ".txt" with write permission
      write reportText to newFile
      close access newFile
    end tell -- end tell front document
  end tell -- end tell application "OmniFocus"
end hazelProcessFile
Thu, Mar 24, 2016 10:29am CDT https://bhlg.us/4gQ6

Want to see my August 2020 Bullet Journal setup?

Join 1,514 subscribers!

I'll send you the link to a six-minute overview video of my August 2020 spreads when you sign up for my newsletter, The Weekly Impulse.

Site Analytics

I use Fathom Analytics on this site because I care about your privacy. And if you ever want to see the stats collected and the data I see, check out the live analytics here.

Amazon Affiliate

joebuhlig.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means to earn fees when linking to Amazon.com and affiliated sites.

Disclaimer

Disclosure of Material Connection: Some of the links in the post above might be “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers. I am disclosing this in accordance with the Federal Trade Commission’s 16 CFR, Part 255: “Guides Concerning the Use of Endorsements and Testimonials in Advertising.”

an analog mind in a digital world

👋 I'm Joe Buhlig. I strive to build productivity systems that stand the test of time and help me do more than check boxes. I'm here to help you do the same.

🎙 I read a lot of books and talk about it.

🐿 I can't focus on one thing for long, so I write a lot of code for an eclectic grouping of projects.

📓 And I'm a bit obsessed with finding non-proprietary solutions to digital problems. Thus, text files for the win! 🎉

MN U.S.A 1986-09-30
  • all
  • articles
  • code
  • likes
  • notes
  • photos
  • replies
  • reposts
  • steps
  • videos
coaching newsletter contact
© 2014-2025 by Joe Buhlig