Jump to content

Auto-Add to Reminders and Calendar


This topic is 3207 days old. Please don't post here. Open a new topic instead.

Recommended Posts

 

Greetings, all.

I have been researching for a few weeks now with few results, so hopefully someone here might be gracious enough to help me out.  I have an event database that, after setting the event date for the new record, will auto-populate a number of fields with due dates for a bunch of different tasks.  My understanding is that I should be able to use AppleScript for this, but I have not been able to figure out how.

My first question: is there a way to have Filemaker add an event to my Mac Calendar once I set the event date and start and end times in the record?  I'd like it to be added to a particular calendar - that is, the "Business" calendar in the Calendar app - with a predetermined format that is a mix of static text and info from fields.  So for example, when it adds the event date and time to my calendar, the event would be titled:
EVT: [FIELD1] & [FIELD2]

In addition, is there a way to have the new calendar event set the "location" field in the Mac Calendar app utilizing one or more of the fields?  So if it has one location, it would just insert that location in the the Mac Calendar location field.  If it has 2 or three, it would be like:
[LOCATION1] / [LOCATION2] / [LOCATION3]

Finally on the calendar topic, I need to make sure that if I change something like the times or location(s), that it auto-updates the calendar event once I validate the field.  Or if I mark the event as "INACTIVE" (they have three statuses: ACTIVE, INACTIVE, COMPLETED) that it removes the event from the calendar completely.


For reminders, as mentioned my record contains a task list that will auto-populate due dates based on when I choose the event date.  Once these fields have their dates auto-populated, I want it to automatically create reminders for each one of the task items in the "Business" reminder list of the Mac Reminders app.  Again, it needs to have a set format so that if I have 30 events going on at once, I know which task is for which event.  So maybe something like:
[EVENT NAME FIELD]: [INVOICE DUE FIELD]
[EVENT NAME FIELD]: [LAYOUT DUE FIELD]
And so forth.  Also, my tasks don't have due times, but is there a way, upon auto-export to the reminders, that I can tell it to set them all to the same due time?  Say 10am?

Lastly, can this sync two-ways?  So if I delete the task from the Reminders app, or mark it as complete, it will delete the date from the field, or mark the task complete in the database record?  Or if I delete the date from the record's field or mark that field as complete, that it deletes the reminder from the app or marks it as complete.

For the task list, I have a checkbox list that has a box connected to each one of the task fields.  If a field is past due, the field's title will show in red.  If I click on that field's checkbox, or if I delete the date from the field, the field title will revert back to black.

I hope someone can either assist me or direct me to a link I can accomplish a task that has been haunting me for a while.  Thanks for your time!

Link to comment
Share on other sites

Of course it figures that when I finally break down and ask for help on a forum, I finally stumble across some of the answers I've been looking for.  I finally figured out what AppleScript is needed to have FileMaker create a Reminder item and a Calendar event.  But there are still a few hiccups.

Firstly: I managed to add a button to my database that will create a new Reminder item for me:
List (
"tell application " & Quote ( "Reminders.app" ) ;
  "set mytitle to " & Quote ( Events::event_name & ":" & " " & "Invoice Due" ) ;
  "set mybody to "& Quote( Events::notes ) ;
  "set mydate to date " & Quote ( Events::date_due_invoice ) ;
  "set mylist to list " & Quote ( "Business" ) ;
  "tell mylist" ;
    "make new reminder with properties {name:mytitle, body:mybody, due date:mydate}" ;
  "end tell";
"end tell"
)

This works without fail.  If I hit the button, a Reminder item is created in the right list with all the info I asked for.  But now I am not sure how to automate this when the "date_due_invoice" field is auto-populated after choosing the event's date.

The first thought I had was to create a script to run multiple AppleScripts when the event date is chosen and the field is validated.  But this presented a problem - being that the script runs before the various task fields have a chance to auto populate, I get "invalid date" errors because the script is, of course, trying to pull dates from fields that have no dates yet.  Though if I go back into the field after the date has been chosen, then re-validate it, it will run the scripts just fine and enter the Reminder items into the app.  Obviously this is not an ideal way to do this.  And I haven't yet figured out a way to run the script after the task fields have been populated.  So I'm stuck here.

This also brought up another problem - if I happen to validate the field again after the Reminder items have been added, it will add them yet again.  So I end up with duplicates.  Is there even a way for Filemaker and Reminders to talk to each other bi-directionally so that I don't get duplicates created?  Or to have a Reminder item updated if I change the date in one of the task items as opposed to creating a second Reminder item with the new date?  Even if it can delete the first one when creating the new one, that would be acceptable.

I also managed to add a button that adds an event to the Calendar.  And while this script can be run after validating the event date field, I am still left with the issue of duplicate events if I ever re-validate the date field, as well as trying to change or delete the old event if the date changes.

 

Link to comment
Share on other sites

Something along these lines

"set myUID to id of ( make new reminder with properties {name:mytitle, body:mybody, due date:mydate} ) " ;

should work to give you the unique id of the new reminder (it works in iCal) – which you can write back into FM to connect the record with the reminder; on changing your event record, you can update the “related“ reminder, rather than create a new one.

Link to comment
Share on other sites

  • 2 weeks later...

This topic is 3207 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.