Is AppleScript broken for Reminders?

Still on Monterey.

I have been playing with Reminders for lists of tasks, and playing with doing some AppleScripting to move things from OmniFocus to Reminders. However (and perhaps not surprisingly) I am running into trouble…

I have a few lists in Reminders, and also some lists that are grouped into folders. What I have found is that if I ask Reminders for every list, I only get the lists that are NOT in folders, eg:

tell application "Reminders"
  set _account to the default account
  tell _account
   get every list
  end tell
end tell

Only gets lists that are NOT in folders.

Further, trying get the list name "ABC" where ABC is a list NOT in ai folder works, but if it is in a folder, the list is not found.
Also, get every reminder in every list only gets reminders that are in lists that are NOT in folders.

Not quite sure where to go from here…

Thoughts?

Try:

tell application "Reminders"
	set accountList to get name of every account
	repeat with i from 1 to (length of accountList)
		set theAccount to item i of accountList as string
		get name of every reminder
	end repeat
end tell

Stephen

@Stephen_C

Thanks!

I have only one account (“iCloud”) so I don’t really need to iterate through accounts, although in general what you have shown is good practice and would be the “right” way to code this.

Beyond that, I don’t see how iterating through accountList affects anything here, because you don’t reference the account in getting the reminder names. Presumably that line should have read get name of every reminder of theAccount.

In any case, if I just do get name of every reminder then I do in fact get all reminders including those in lists that are within a folder, so your code helps me there. Thanks!

However, if I do get every list I still only see lists that are not in Folders. It doesn’t matter if I get the list names instead, eg get the name of every list; if I tie it to accounts: get the name of every list in the default account or get the name of every list in the account named "iCloud", or any other permutation.

Further, if I try exists the list named "ABC", if ABC is the name of a list NOT in a folder the result is true but if ABC is the name of a list in a folder, the result is false, and yet I am looking at those lists in the Reminders app,

Apparently this is a known problem with both groups and subtasks in Reminders. You can get part way there by doing “get every reminder” and then examining the “container” element of each reminder, which will give you the list in which the reminder resides (whether that list is within a group or not).

There does not seem to be any way to get the group’s name.

I think not: in my case that gives an error.

Stephen