Alex Rivera | Logout

How to send an imessage text with applescript, only in provided service?

Asked 2012-08-04T21:40:20.853
27

Can somebody show me how to send a message directly to the user of iMessage via Messages app?

tell application "Messages"
    if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 1
    if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 2
    if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 3

    send "Message" to buddy "mail of name" of service x
end tell

I need to send a message to an account only via iMessage, not via google talk, AIM, bonjour. Thank you!

Edit
Report

1 Answer

4

Examples:

get services
get name of services
get buddies
get name of buddies 

Your line:

send "Test-Message" to buddy "buddy" of service "service"

seems to work if "buddy" and "service" is valid.

I have my iMessage with my Apple-ID registered, so when I execute "get name of services" I get for this service a string like

"E:myAppleID@host.com"

which I can use for "service". Buddy is just the name of your buddy, also as pure text. See "get name of buddies".

Hope it works!

answered 2012-08-19T23:59:33.567

Your Answer