3 Replies Latest reply on Nov 14, 2015 9:22 AM by user14336

    Return Applescript value to FMP from Reminders.app.

    user14336

      Dear All

      I want to create reminders in the Reminders.app on OS X.  I have a button on the layout that does this very well using a calculated apple script.

      What I need to do is get the id of the result from the reminders app, and put that into a field on the layout that called the applescript (which I will use later to delete the reminder using another applescript).

       

      The end of my scrips looks like this:

       

      List (

      ....

      "tell mylist" ;

          "set result to make new reminder with properties {name:mytitle, body:mybody, due date:mydate, priority:thepriority}" ;

         "end tell";

      "return the id of result";

      "end tell";

      "tell application " & Quote ( "FileMaker Pro Advanced" ) ;

        "set cell ReminderUUID of current record to the id of result";

      "end tell" ;

      )

       

      It creates the reminder in the Reminders App, but I can't get it to send back the id.

       

      Any suggestions greatly appreciated.

       

      Steve

        • 1. Re: Return Applescript value to FMP from Reminders.app.
          fclark

          suggestions: set newvariable to the id of the result

          set cell reminderuuid of current record of the current layout to the  newvariable.


          IF that does not work create a handler that passes the newvariable then

            nest a tell window and a tell layout inside the tell application block(then you would NOT include the "of current layout")

          • 2. Re: Return Applescript value to FMP from Reminders.app.
            user14336

            Many thanks

             

            I've got this working now with the following:

            List (

            ...

            "set theID to id of result";

            "set theID to theID as text";

            "tell application " & Quote ( "Filemaker Pro Advanced" ) ;

            "set cell \"ReminderUUID\" of current record to theID";

            "end tell";

              "end tell";

            "end tell";

             

            )

             

            However, now I need to concatenate the ReminderUUID field value in order to create a scrip to delete the entry in Reminders app.

             

            Here's what I have so far (which doesn't work!!)

             

            List (

            "tell application " & Quote ( "Reminders.app" ) ;

            "delete reminder id "  & "x-apple-reminder://" & Quote ( EVENTS::ReminderUUID)  ;

            "end tell";

            )

             

            The problem is getting "x-apple-reminder://" and the value of the ReminderUUID together.

             

            Any suggestions?   Sure it's simple but failing to see it.

             

            Cheers

             

            Steve

            • 3. Re: Return Applescript value to FMP from Reminders.app.
              user14336

              Actually I've figured it out. (I had to delete the "set theID to the theID as text line in the first script".

               

              Here's the final answer:

               

              This is the applescript that retrieves the UUID from reminders and stores it FM:

               

              List (

              "tell application " & Quote ( "Reminders.app" ) ;

               

              [DEFINE REMINDER CONTENT HERE]...

               

              "tell mylist" ;

                  "set result to make new reminder with properties {name:mytitle, body:mybody, due date:mydate, priority:thepriority}" ;

              "set theID to id of result";

              "tell application " & Quote ( "Filemaker Pro Advanced" ) ;

              "set cell \"ReminderUUID\" of current record to theID";

              "end tell";

                "end tell";

              "end tell";

               

               

              )

               

              This is the applescript that takes the stored UUID in FM and deletes the corresponding reminder from Reminders;

               

              List (

              "set UUID to " & Quote (EVENTS::ReminderUUID);

              "tell application " & Quote ( "Reminders.app" ) ;

              "delete reminder id UUID"  ;

              "end tell";

              )