Is it possible for a Mac app to invoke the Messages app to send a message to a particular contact or phone number? The only plausible lead I'm found was the IMService framework, but that seems to be deprecated in 10.9 Mavericks.
Asked
Active
Viewed 2,235 times
1 Answers
1
One possible approach would be to use Apple Script to send messages via the Messages application.
See this question for an example:
How to send a message using iChat and AppleScript
-
Thanks. The script works by itself, but not when invoked from another app using NSAppleScript. I get a message in the console: "error while executing script. Error { NSAppleScriptErrorAppName = Messages; NSAppleScriptErrorBriefMessage = "A privilege violation occurred."; NSAppleScriptErrorMessage = "Messages got an error: A privilege violation occurred."; NSAppleScriptErrorNumber = "-10004"; NSAppleScriptErrorRange = "NSRange: {110, 41}"; }" – Z S Mar 11 '14 at 23:14
-
-
This error is described in detail here: https://developer.apple.com/library/mac/releasenotes/AppleScript/RN-AppleScript/RN-10_6/RN-10_6.html – cacau Mar 12 '14 at 07:03
-
It is sandboxed. I have followed some instructions on adding the relevant entitlements, but it still doesn't work. In particular, in com.apple.security.scripting-targets, I added:
com.apple.iChat com.apple.ichat.applescript – Z S Mar 12 '14 at 18:19