Try opening the Calendar app first by using "Activate":
Tell application "Calendar"
set numEvents to the number of events in calendar "TEST"
No, same error. Does it happen to you? I didn't tell the Editor to activate Calendar.
Take out the call for every event, just leave the Tell app "Calendar" and tell calendar "Test" and there's no error. The AS seems able to access the calendar but unable to access Calendar functions, but only through Filemaker. It runs fine through the Editor.
Also, I can't Send Event in FM14, which I did all the time in FM12. I get a "... can't be found" error for a file that sits next to the FM file. This seems a version error. I'm trying to find FM12 to test this.
No error message on my macOS 10.12.4 and FMPA 15.0.3.
The Calendar opens. However, I did not check the numEvents result.
I'm going to run the 10.12.4 update and see what happens. If still a problem then it looks like the FM14 could be the problem. I keep getting the 1743 error from Filemaker, no problem through the Editor.
Thanks for the help!
I'm on 10.12.4 and still get the 1743 error. Am I to believe that no one was able to run Calendar events throughout version 14? Doesn't seem possible.
I want to be sure: You are running FM15. You run an AppleScript such as:
tell application "Calendar" to return every event of calendar "TEST"
And you get no error 1743?
Here is the AppleScript that I'm using on 10.12.4 in FMPA 15.0.3 with Perform AppleScript:
Tell application "Calendar"
return every event of calendar "Away"
Note that I'm using "Away" since I don't have a calendar "Test" setup in my Calendar app.
It returns error code 0.
If I use "Test" instead of "Away", it returns error code -1728
I think it's an access issue. Filemaker is checked under the Privacy tab. But I just updated to FM 14.0.6. Now it pops a dialog "Filemaker wants to access your Calendar". Click "Allow" but the dialog stays there. Won't go away unless you click "Don't allow". Can't find this issue on the web yet. Should I start a new thread?
Thanks for you help!
It could be due to your user's permissions. Are you using an administration account on your Mac? Are you logged into FileMaker with [Full Access] privileges?
I suggest you create a new, very small FMP file with just one button and one script to test a simplified AppleScript with the Calendar app (like the one attached).
Calendar.fmp12.zip 108.9 K
I went to FM15. The Perform AppleScript now runs. Send Event continues to fail. FM can't seem to find anything, including an AS script or app sitting right next to it.
If you're able to Send Event, please let me know.
I had problems with Send Event too.
Instead, I used a calculated AppleScript to tell application "Terminal" to do shell script …. Convoluted, yes. At least it works.
But Send Event used to work. I'm afraid to fire up the various scripts I have with Send Event, to see if they crash in newer FM. I'll finish this up, deal with that aggravation later.
Just to provide a data point: Jade's demo file worked as described on my install of FMPA 14.0.6 on OS X 10.10.5 on a MacBook Pro (traveling this month). I'll upgrade this computer soon, but been to deep in work to mess with it.