The brand new options added to the “upgraded” format of reminders in macOS Catalina should not supported by AppleScript, apparently.
One other case of Apple not consuming its personal pet food.
Nevertheless, there’s a thread on MacScripter.internet the place the person @robertfern defined the right way to entry the sqlite database through which the Reminders.app shops its information.
Hyperlink: https://www.macscripter.internet/t/reminders-app-sub-reminders-are-invisible-to-applescript
Right here is the code he posted:
use AppleScript model "2.4" -- Yosemite (10.10) or later
use scripting additions
property Head : ""
property Database : ""
property Tail : quote
property DBLocation : (path to dwelling folder as textual content) & "Library:Reminders:Container_v1:Shops:" --sqlite-wal
property schema : lacking worth
property lastTable : lacking worth
property foundRows : {}
property otherRows : {}
on run
native myFields, aTable, aField, Question, QueryResult, aRow, reminderLists, listNames, myList
--set Head to "sqlite3 " & (quoted type of Database) & house & quote
if Database is in {"", lacking worth} then
if DBLocation is in {"", lacking worth} then
return false
else
set Database to getDatabase()
finish if
finish if
set schema to getSchema for Database given desk:{"ZREMCDOBJECT", "ZREMCDREMINDER"}
--set schema to getSchema for Database
set reminderLists to getLists()
set listNames to {}
repeat with i from 1 to rely reminderLists -- get names
set finish of listNames to merchandise 4 of merchandise i of reminderLists
finish repeat
set myList to select from listing listNames
if class of myList is boolean then return
set myList to merchandise 1 of myList
set i to (rely reminderLists)
repeat whereas i > 0
if (merchandise i of listNames) = myList then exit repeat
set i to i - 1
finish repeat
if i = 0 then return
set myList to merchandise i of reminderLists
return getReminders(myList)
finish run
on getReminders(aList)
native Question, myFields, QueryResult, aRow, n, aTable, aField, flag --, compFields, diffFields
set textual content merchandise delimiters to ", "
repeat with findTable in {{"ZREMCDREMINDER", {"ZACCOUNT", "ZLIST", "ZSTATUS", "ZCKIDENTIFIER", "ZCKPARENTREMINDERIDENTIFIER", "ZDACALENDARITEMUNIQUEIDENTIFIER", "ZNAME", "ZNAME2", "ZTITLE1"}}, {"ZREMCDOBJECT", {"ZACCOUNT", "ZLIST", "ZSTATUS", "ZCKIDENTIFIER", "ZCKPARENTREMINDERIDENTIFIER", "ZDACALENDARITEMUNIQUEIDENTIFIER", "ZNAME", "ZNAME2", "ZTITLE1"}}}
set flag to false
repeat with aTable in schema
set aTable to contents of aTable
if tableName of aTable = (merchandise 1 of findTable) then
set flag to true
exit repeat
finish if
finish repeat
if flag then exit repeat
finish repeat
set Question to "Choose " & ((merchandise 2 of findTable) as textual content) & " from " & (merchandise 1 of findTable) & " the place ZLIST = " & (merchandise 1 of aList) & " and ZCOMPLETED = 0 " & ";"
attempt
set QueryResult to paragraphs of (do shell script Head & Question & Tail)
on error errMsg quantity errorNumber
show dialog errMsg & ", " & (errorNumber as textual content)
finish attempt
set textual content merchandise delimiters to "|"
set foundRows to {}
repeat with aRow in QueryResult
set contents of aRow to textual content objects of contents of aRow
finish repeat
return QueryResult --ZCKPARENTREMINDERIDENTIFIER if it has a guardian
finish getReminders
on getLists() -- get all Reminder lists
native myFields, aTable, aField, Question, QueryResult, aRow
if schema is in {{}, lacking worth} then return false
set flag to true
repeat with aTable in schema
set aTable to contents of aTable
if (tableName of aTable) = "ZREMCDOBJECT" then
set flag to false
exit repeat
finish if
finish repeat
if flag then return false -- desk wasn't discovered
set textual content merchandise delimiters to ", "
set myFields to {"Z_PK", "ZACCOUNT", "ZCKIDENTIFIER", "ZNAME2"}
set Question to "Choose " & (myFields as textual content) & " from " & (tableName of aTable) & " the place ZNAME2 != ''" & ";"
attempt
set QueryResult to paragraphs of (do shell script Head & Question & Tail)
on error errMsg quantity errorNumber
show dialog errMsg & ", " & (errorNumber as textual content)
finish attempt
set textual content merchandise delimiters to "|"
repeat with aRow in QueryResult
set contents of aRow to textual content objects of contents of aRow
finish repeat
return QueryResult --foundRows
finish getLists
on getSchema for Database given desk:tblName : lacking worth
native Question, sqlData, fldType, schema, i
set schema to {}
if Database is in {"", lacking worth} then return false
if Head is in {"", lacking worth} then set Head to "sqlite3 " & (quoted type of Database) & house & quote
--SELECT title tableName, sql FROM sqlite_master WHERE sort="desk" AND tableName="COD"
if class of schema just isn't listing then set schema to {}
set Question to ".tables"
attempt
set sqlData to do shell script Head & Question & Tail
on error errMsg quantity errorNumber
show dialog errMsg & ", " & (errorNumber as textual content)
return
finish attempt
set sqlData to get phrases of sqlData
if tblName ≠ lacking worth then
if (class of tblName) just isn't listing then
if (class of tblName) is textual content then
set tblName to {tblName}
else
return false
finish if
finish if
set c to 1
repeat with i from 1 to rely tblName
if merchandise i of tblName just isn't in sqlData then
set merchandise i of tblName to merchandise c of tblName
set c to c + 1
finish if
finish repeat
set sqlData to objects c via -1 of tblName
finish if
repeat with aRow in sqlData
set finish of schema to {tableName:contents of aRow, fields:{}}
set tblName to contents of aRow
set Question to "PRAGMA table_info('" & tblName & "')"
attempt
set sqlData to do shell script Head & Question & Tail
on error errMsg quantity errorNumber
show dialog errMsg & ", " & (errorNumber as textual content)
return
finish attempt
set sqlData to paragraphs of sqlData
set textual content merchandise delimiters to "|"
repeat with aRow in sqlData
set tmp to textual content objects of aRow
set fldType to merchandise 3 of tmp
if fldType = "" then
set fldType to "TEXT"
else if fldType = "INT" then
if merchandise 2 of tmp ends with "_bool" then
set fldType to "BOOL"
else if merchandise 2 of tmp incorporates "date" then
set fldType to "DATE"
finish if
else if fldType = "REAL" then
-- do nothing
finish if
set contents of aRow to {fieldName:merchandise 2 of tmp, fieldType:fldType}
finish repeat
set fields of final merchandise of schema to sqlData
finish repeat
return schema
finish getSchema
on getDatabase()
native Database, folderList, modDate, diff, myInfo, flag
set folderList to listing folder DBLocation
set modDate thus far "Thursday, January 1, 1970 at 12:00:00 AM"
set prevSize to 0
repeat with aFile in folderList
set aFile to (DBLocation & (contents of aFile)) as alias
set myInfo to (data for aFile)
if title extension of myInfo = "sqlite" then
set flag to false
set diff to (modification date of myInfo) - modDate
if diff < 360 and diff > -360 then
if (measurement of myInfo) > prevSize then
set flag to true
finish if
else if diff > 0 then
set flag to true
finish if
if flag then
set prevSize to measurement of myInfo
set modDate to modification date of myInfo
set Database to POSIX path of aFile
finish if
finish if
finish repeat
return Database
finish getDatabase