How to move reminders from one list to another by Applescript

applescriptreminders

I have an use case where I want to move certain reminders I created using Siri from the default list to another. Programmatically, via an AppleScript script, which runs on a Mac.

tell application "Reminders"
    set output to ""
    set inBoxList to "Erinnerungen"
    set newList to "Ausgaben"
    show list newList -- this works
    if (count of (reminders in list inBoxList whose completed is false)) > 0 then
        set todoList to reminders in list inBoxList whose completed is false
        repeat with itemNum from 1 to (count of (reminders in list inBoxList whose completed is false))
            set reminderObj to item itemNum of todoList
            set nameObj to name of reminderObj
            set idText to id of reminderObj
            if (nameObj contains "€" or nameObj contains " Euro ") then
                set output to output & "• " & nameObj
                set completed of reminderObj to "no"
                set container of reminderObj to list "Ausgaben" -- this doesn't
            end if
        end repeat
    end if
    return output
end tell

It's the following line that doesn't work:

set container of reminderObj to list "Ausgaben" -- this doesn't

I've tried variations like

set newList to list "Ausgaben"
set container of reminderObj to newList

but I always get an error that boils down that I can't set the container because it's not f the correct type list.

Best Answer

You can't change the container, because this property is read only --> container (list, r/o) : r/o means read only

But you can use the move command

tell application "Reminders"
    set output to ""
    set newList to list "Ausgaben"
    show newList
    repeat with thisReminder in (get reminders in list "Erinnerungen" whose completed is false)
        set nameObj to name of thisReminder
        if (nameObj contains "€" or nameObj contains " Euro ") then
            set output to output & "• " & nameObj
            move thisReminder to newList
        end if
    end repeat
    return output
end tell