Here is the appleScript part of my script:
tell application "Finder" activate open application file "Messages.app" of folder "Applications" of folder "System" of startup disk
end tell
What I need is a step to send the message already inside the Mesage.app. The message is ready to send. I just would like a step that will act as "Return" to send the message.
Again I have already prepared message to send but just need a step to send the message. Is there a possible step to perform the" Return" command to iMessage?
AppleScript supports semantic scripting, that is, you’re working with the object layer of the targeted app, not with its UI. The app gets to choose which operations it supports on which objects, and it seems that Messages chose not to support unmediated message sending.
Simulating a Return in the Messages window isn’t semantic scripting, it’s UI scripting. macOS supports UI scripting via the Processes Suite within System Events. You can use that to discover windows and controls, synthesise keyboard and mouse events, and so on. If you search the ’net for these terms, you’ll find plenty of examples.
IMPORTANT UI scripting is gated by the System Settings > Privacy & Security > Accessibility privilege.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"