applescript and calendar and mavericks trouble

Posted on
Sat Nov 09, 2013 5:04 pm
ELWOOD offline
Posts: 225
Joined: Feb 11, 2007
Location: Ramsey, NJ

applescript and calendar and mavericks trouble

Been having a problem for quite a long time but it was very intermitant and did not have time to investigate what was causing it. After upgrading to Mustangs it is now happing all the time so I started investigating.

It is related to a few triggers that run from Berkienet’s AD2USB alarm interface plugin (don’t worry Richard it’s not your plugin) I have many triggers that run with the plugin that cause no trouble, but have now found it;s the ones that access the calendar program. The trouble is a number of imbedded applescripts. They write an entry to few different calendars indicating when the alarm is turned on and off, when a door is locked or unlocked, also when any of the outdoor motion detectors see’s motion. "It's great I can look back 2 years ago and see the date and time when the UPS guy left a package behind my delivery door".

This is one version of the script:

tell application "Calendar"
tell calendar "Outside"
set theDate to current date
make new event at end with properties {summary:"Backyard Motion", start date:theDate}
end tell
end tell


Now running Mavericks any time any version of the script is run the server hangs, client computers get an error “server not responding”. The hang lasts a few minutes than starts working at which point I get the following errors:

Nov 9, 2013, 4:31:12 PM
Trigger Back Yard Motion Speak and count NIGHT
Sent INSTEON "Deck Spots" on to 100
Schedule Back Yard Motion Speak and count NIGHT (delayed action)

Nov 9, 2013, 4:33:23 PM
TED 5000 Plugin Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 66, in runConcurrentThread
<type 'exceptions.StandardError'>: ServerCommunicationError -- timeout waiting for response

TED 5000 Plugin Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
WeatherSnoop Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 222, in runConcurrentThread
<type 'exceptions.StandardError'>: ServerCommunicationError -- timeout waiting for response

WeatherSnoop Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
TED 5000 Plugin Polling Interval: 120
Error script error: Calendar got an error: AppleEvent timed out. (-1712)

Tried running the script in the applescript editor, the results screen shows running for a few minutes, than shows error:
error "Calendar got an error: AppleEvent timed out." number -1712

The script still works in that the information is send to the proper calendar, even that it timed out.

The intermittent hangs before mavericks gave the same type of error (plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)) but not every time, now with mavericks it happens every time.

Thanks for any suggestions
Elwood

Posted on
Mon Nov 11, 2013 10:36 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: applescript and calendar and mavericks trouble

Our recommended best practices for AppleScripts that talk to other applications is to either put them in a try block with a timeout so they won't hang up the server or better yet run them as external scripts so they're run in an entirely different process than the server.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Nov 11, 2013 9:33 pm
ELWOOD offline
Posts: 225
Joined: Feb 11, 2007
Location: Ramsey, NJ

Re: applescript and calendar and mavericks trouble

Jay thanks for the tip.
Redid the triggers to run external scripts. That fixed the Indigo hang. But running the scripts from the editor was still
getting the timeout error, except for one. That was for the delivery received door which only runs 3 or 4 times a week.
All the others run many times a day. The calendar has been used with the triggers for about 2 1/2 years. Deleted the
calendars purging all the data then reentered the calendars. Now they all run with no delay. Could it be that the calendar
program was taking a longer time to process due to all the events stored?
Well all is now working so thanks again for all your help.

Elwood

Posted on
Mon Nov 11, 2013 9:53 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: applescript and calendar and mavericks trouble

No idea why iCal was behaving badly.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 23 guests