Welcome Guest (Log in)


Calendar (8) | Applescript (6) | Database (6) | SQLite (4) |
Expander triangle
  • Author
  • Rating
  • Type
  • Revision
  • Downloaded
  • Updated
  • Roberto Trevisan
  • StarStarStarStarStar
  • Stack
  • 2
  • 491 Times
  • 18 September 2018
Read OSX Calendar.app using SQLite
lib_OSXCal v2 by Trevix Design 2018 - www.software.trevix.it info@trevix.it


This stack is to be used as a library in order to interact with the OSX "Calendar.app", reading and writing.

It was developed in the hope to sync my app "Tcal" (http://www.software.trevix.it/tcal/en/index.html) with the OSX Calendar.app
I am still working on it but, I must confess, things are getting too big and complex to be handled just by myself.
Meanwhile, in case I wont be able to realise that, I hope some LC developer will find this stack useful.

This library uses a mix of SQLite reading of the "Calendar Cache" file, applescript and the Shane's "CalendarLib EC.scptd" library (https://www.macosxautomation.com/applescript/apps/Script_Libs.html) that must be installed.
Applescript could handle everything, but reading directly the "/Users/UserName/Library/Calendars/Calendar Cache" SQL database is much faster and open up possibilities.
And working with Applescript is a real pain, compared to Livecode.

It has been tested on OSX 10.12.6 (Sierra) with LC 8.1.10/9.0.1 with the help of the free "DB Browser for SQLite" application (you don't need this but is useful in order to explore: just open the Calendar Cache file in the mac library.)

Please note that as from here "https://github.com/burczyk/CalendarInvitesCleaner/blob/master/Readme.md", the OSX "Calendar.app" also uses the "Write-Ahead Logging". When you open Calendar.app you can sometimes see "Calendar Cache-wal" and "Calendar Cache-shm" files under the same path of the "Calendar Cache".
I am having hard time figuring out how these files work, if they can mess out the SQLlite reading/writing or, for what I know, screw the all calendar database.

At this time, this stack has 8 libraries functions. Only 1 of these relay in database reading. I haven't tried to create calendars using SQLite but for shure you cannot refresh the Calendar.app with it:

SQLite :
- LibCal_GetAllCalEvents : get events from selected calendars in a selected date range or a single event, given its UID

- LibCal_CreateCal : create calendars form a list array, on the Calendar.app (if you need iCloud calendars, move them later)
- LibCal_GetCalID : given the name of a calendar (local) get its UID, creating it if it does not exsist (if you need iCloud calendars, move it later)
- LibCal_Reload : refresh Calendar.app if open
- LibCal_CheckIfOpen : check if the Calendar app is running
- LibCal_NewEvent : given an event array, create the event on the Calendar.app

Applescript and the "CalendarLib EC.scptd" library:
- LibCal_DeleteEvent : given its UID, delete an event, no matter where
- LibCal_EditEvent : given an event array, edit it in Calendar.app

Do your experiment at your own risk and, if you want to update this stack or have any idea on how to improve it, please let me know.

Trevix Design
Ajax Loader
Expander triangle
User Comments
Expander triangle