Tasks & Events from Calendar.app and OmniFocus into Tinderbox

This isn’t a task I really do so I’m at a loss as to what to suggest. However, I have updated aTbRef8 to use the correct naming of the TaskPaper article.

As I understand it, Taskpaper can set $StartDate, $EndDate and $DueDate; these are system attributes so always present. This is totally unconnected with whether you see those attributes as a KA. The built-in prototype ‘Event’ shows those three attributes as KA - regardless of whether those attributes have values.

However, adding a TaskPaper event to a Tinderbox file doesn’t, AFIAK, either (a) add the event prototype if not present in the Tinderbox and/or (b) apply that prototype to the new note created.

Thanks @mwra for the Taskpaper update.

However, the main focus of my last question really lies on bringing Calendar-Dates or Events into Tinderbox, not so much Taskpaper-Tasks.

And I am somewhat surprised that this should be such a hard thing to achieve in Tinderbox since bringing in all kind of task-related information (like OmniFocus-tasks or Taskpaper-tasks) Calendar-Events in comparison bear just as little information as StartDate and EndDate.

Any ideas @eastgate?

Just to say that I too would appreciate a method to bring events into TB. I confirmed with some testing that it can be done in TB7, but the ability has been lost in TB8

Be sure that Tinderbox is permitted to access your calendar in System Preferences ▸ Privacy; changes in Mojave may require you to grant permission.

We’re currently investigating a Mojave issue where macOS fails to ask for permission, and simply assumes that permission was declined.

1 Like

There doesn’t seem to be a way to grant Calendars access to a chosen app. The dialog doesn’t have an add button.

  • Adding full disk access doesn’t seem to do the trick
  • If relevant, Tinderbox 7 has access - maybe moving it would help?

I can’t figure out how to provide a clickable link back to Calendar (unlike Mail, no URL scheme, so uid here is unused) but, pending a possible future built-in solution, the new AppleScript capabilities in Tinderbox allow you to bring in the start date, end date, summary, description (notes) and location for events in a specific calendar in Calendar. Below is a bare-bones script that does that. Copy-paste into Script Editor (in Applications > Utilities), edit the name of the calendar to match what you have in Calendar, and with a Tinderbox document open, click run. As always make a backup of your Tinderbox document first.

#--------------------------------------------------------------------------------
# Imports events from Calendar into front Tinderbox 8 document
# TO USE: Edit calendar name from "Test" to actual name, and
#              with Tinderbox doc open, click run

property targetCalendar : "Test"

set containerName to "Imported Events"
set keyAttributesStr to "StartDate;EndDate;DueDate;MyString"

# Initialize list variables to hold Calendar event properties
set {summaryLst, descriptionLst, startDateLst, endDateLst, uidLst, locationLst} to {{}, {}, {}, {}, {}, {}}

set importCounter to 0

tell application "Calendar" to tell calendar targetCalendar
	set eventList to events
	set eventCount to eventList's length
	
	# place each Event 'property' in an AppleScript list
	repeat with anEvent in eventList
		tell anEvent
			set end of summaryLst to summary
			set end of descriptionLst to description
			set end of startDateLst to my dateToStr(start date)
			set end of endDateLst to my dateToStr(end date)
			set end of locationLst to location
			set end of uidLst to uid
		end tell
	end repeat
end tell

tell application "Tinderbox 8"
	tell front document
		if not (exists) then error "No Tinderbox document open."
		
		#  create container for imported messages
		if not (exists note containerName) then
			set newNote to make new note at before first note
			tell newNote to set name to containerName
		end if
		
		# create a note for each selected Mail message in designated container
		repeat with i from 1 to eventCount
			set newNote to make new note at note containerName
			tell newNote
				## Map Tinderbox 'attributes' to Calendar event 'properties':
				set value of attribute "Name" to item i of summaryLst
				set value of attribute "Text" to item i of descriptionLst
				set value of attribute "StartDate" to item i of startDateLst
				set value of attribute "EndDate" to item i of endDateLst
				set value of attribute "MyString" to item i of locationLst
				## Assign values to non-Calendar-related attributes:
				set value of attribute "KeyAttributes" to keyAttributesStr
				set value of attribute "Width" to 8
				set value of attribute "Badge" to "clock"
			end tell
			set importCounter to importCounter + 1
		end repeat
		
	end tell
end tell

display notification "Imported " & importCounter & " events of " & eventCount & " total"

# handlers (=subroutines)
to dateToStr(aDate) --> convert AppleScript date to string format that Tinderbox recognizes
	tell aDate to return short date string & ", " & time string
end dateToStr
1 Like

The first time I dragged an event from Calendar into TB and added $StartDate as a key attribute, I was prompted to give TB access to the calendar. It did not, however, populate StartDate.

Dragging subsequent events from Calendar to TB does populate the $StartDate.

Dragging events from Fantastical (my preferred calendar tool) sets $Text to a sort of text representation of the event, something like:

May 28, 2019 at 9:00 AM - 10:00 AM
My meeting name
My meeting location

My meeting notes

No $StartDate though.

The first drag (ever) might well time out if you don’t give permission fast enough. Just repeat it.

I don’t know what Fantastical puts on the clipboard; we could likely support it if there’s sufficient interest.

Fantastical is the calendar I use also, fwiw.

This is what a copied event from Fantastical has on the clipboard over here

May 26, 2019 at 7:00 PM - 7:30 PM
Daily Task Planning

This is a note

I use Fantastical, but I’d suggest that rather than try to support everyone’s favorite calendar that supporting .ics import might be more cost efficient? AFAIK, Calendar, BusyCal, Fantastical and any other calendar worth its salt export in the .ics format. (Not drag-out. Export.)

1 Like

If you’re having trouble dragging events from your Calendar to Tinderbox 8.0.2, try this

  1. Quit Tinderbox
  2. Open System Preference
  3. Select Privacy and Security
  4. Go to the Privacy pane
  5. Choose Calendars
  6. Tinderbox 8 may already be checked. If it is, uncheck it.
  7. Now, recheck Tinderbox 8

This may help convince the system that you’ve granted permission

Tinderbox doesn’t show up in the list, and there doesn’t seem to be a method to add it. Frustrating.

If you move Tinderbox 8.0.2 to your application folder and run it, it should ask for permission either on launch or when you drag an event from Calendar.app to Tinderbox.

If that doesn’t happen, you may need to reset privacy permissions. Sigh

Having hit this, I guess the issue is the permissions are there to keep us users safe. So, if they do get into a wrong state, making it too easy for the user to fix it themselves nixes the security. It’s a shame Apple haven’t thought of a way to do some form of verified fix (perhaps via the app) as my experience across the many apps is that Apple have done a poor job of ensuring privacy setting requests don’t get lost behind other window or give warning/feedback that you have (unintentionally) not correctly completed the privacy request.

Perhaps OS 10.15 will get better at the underpinnings.

For the time being, I guess, we’ll have (following @mwra’s last post) to live with it.

Nonetheless, it’s surprising that after resetting the privacy permissions, apps like Fantastical, for instance, always (successfully) re-request the respective permission.

Do you think @eastgate that the maker of Fantastical, flexibits, could offer some help on this?

Privacy permissions in the macOS privacy database, are reset using tccutil.

This is an extremely powerful command. It takes effect immediately and there is no undo and no way to restore.

A few months ago, to resolve a privacy permissions issue with another app (nothing to do with Tinderbox) I accidentally reset the entire privacy database. I spent the next two months carefully replying to macOS “do you want…” requests.

Be careful not to use this incorrectly.

tccutil(1)                BSD General Commands Manual               tccutil(1)

NAME
     tccutil -- manage the privacy database

SYNOPSIS
     tccutil command service [bundle_id]

DESCRIPTION
     The tccutil command manages the privacy database, which stores decisions the user has made about whether apps may
     access personal data.

     One command is current supported:

     reset    Reset all decisions for the specified service, causing apps to prompt again the next time they access the ser-
              vice. If a bundle identifier is specified, the service will be reset for that bundle only.

EXAMPLES
     To reset all decisions about whether apps may access the address book:

           tccutil reset AddressBook
           tccutil reset All com.apple.Terminal

Darwin                           April 3, 2012                          Darwin
2 Likes

Thanks for the pointer on tccutil. However, still no joy dragging a Calendar event into Tinderbox (StartDate 'never') after stumbling about in Terminal like this.

51%20AM

It would seem I need to do something differently. But what?

“Tinderbox 8” is not the bundle ID. I believe this is:

com.eastgate.Tinderbox-8

Resetting “Calendar” does not reset other app’s access to Calendar, it resets Calendar’s access to other apps.

Thanks. Unfortunately still having trouble with this.