Using javascript am trying to add a reminder with a due date to a record.
Reading the well documented AppleScript dictionary (selecting Javascript variant from the dropdown) it states this:
make method : Make a new object.
make
new: type : The class of the new object.
[at: location specifier] : The location at which to insert the object.
[withData: any] : The initial data for the object.
[withProperties: Record] : The initial values for properties of the object.
→ specifier
Well that certainly makes the syntax crystal clear. The best part about the documentation is the inclusion of example syntax.
With some experimentation and digging through the discourse I ended up here:
app.make({new: 'reminder', withProperties: {schedule: 'once', alarm: 'alert', alarmString: 'alarm string', dueDate: due, at: r}});
(r is the record)
When running this events in the Script Editor yield:
app.Reminder({"schedule":"once", "alarm":"alert", "alarmString":"alarm string", "dueDate":{"$L":"en", "$d":Fri Jul 10 2020 00:00:00 GMT-0400 (EDT), "$x":[object Object], "$y":2020, "$M":6, "$D":10, "$W":5, "$H":0, "$m":0, "$s":0, "$ms":0, "parse":[object Object], "init":[object Object], "$utils":[object Object], "isValid":[object Object], "isSame":[object Object], "isAfter":[object Object], "isBefore":[object Object], "$g":[object Object], "unix":[object Object], "valueOf":[object Object], "startOf":[object Object], "endOf":[object Object], "$set":[object Object], "set":[object Object], "get":[object Object], "add":[object Object], "subtract":[object Object], "format":[object Object], "utcOffset":[object Object], "diff":[object Object], "daysInMonth":[object Object], "$locale":[object Object], "locale":[object Object], "clone":[object Object], "toDate":[object Object], "toJSON":[object Object], "toISOString":[object Object], "toString":[object Object], "millisecond":[object Object], "second":[object Object], "minute":[object Object], "hour":[object Object], "day":[object Object], "month":[object Object], "year":[object Object], "date":[object Object]}, "at":app.databases.byId(2).contents.byId(25447)}).make()
It does seem like we’re on the right track - but we end up with:
Result:
Error -10024: Can’t make or move that element into that container.
Any ideas on how to tweak the syntax much appreciated.