AppleScript to send new iMessage

Hey guys - I'm trying to create an apple script to send a new iMessage. But I'm stuck. Can anybody help?


tell application "System Events"

tell application "Messages" to activate

tell process "Messages"

click menu item "New Message" of menu "file" of menu bar 1

end tell

...

endtell


... and thats it. How Do I tell Messages to fill in an email adress or phone number now and to send it?


Thank you!

Mac Pro (Early 2008), OS X Mountain Lion (10.8.2)

Posted on Sep 21, 2012 3:05 AM

Reply
22 replies

Apr 14, 2015 7:37 AM in response to Camelot

This is what I'm using and it works great! But I need some help to try something a little different.

tell application "Messages"

set theBuddy to buddy "+19525551212" of service "SMS"

send "Hi there" totheBuddy

end tell

Instead of "Hi there", I would like the script to look into a text document or an excel document or within the apple script and randomly pick a provided sentence. We can use the following sentences for example:

I love you.

Hope you have a good day.

Good morning.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript to send new iMessage

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.