I have an application for mac and I use the following applescript code (exported as an AS app) to start that app periodically:
on idle tell application "System Events" tell application "MyApp" run end tell return 7 end tell end idle
I use [NSApp terminate:self] in MyApp to terminate itself after it finished its work.
The problems is that the AS script displays a "Connection is invalid" error message when it tries to run MyApp the second time and onward. The error does not show up in the first launch.
I'm guessing [NSApp terminate:self] is causing the conflict with the AS somehow, but why?