Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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!

like image 423
cre8eve Avatar asked Aug 04 '12 21:08

cre8eve


People also ask

How do you send a custom iMessage?

To manually add effects to your iMessage, open the Messages app and type your text. Then "long-press" (press and hold for a second or so) on the blue arrow that you usually tap to send a message. This brings up your special effect options. These are divided into two categories: bubble and screen effects.

Can you send an automated message on iMessage?

Select Time of Day Tap Month and scroll down to adjust the date you want the message sent on. When you're finished, tap Next. Scheduling messages in iMessage this way will set up an automatically recurring message to go out on the same date at the same time each month.


1 Answers

Instead of having to hard-code the iMessage service, you can find it automatically:

  1. Save the following script as sendMessage.applescript (Note: make sure to choose the Text option).
  2. Execute it by running: osascript sendMessage.applescript 1235551234 "Hello there!".
  3. This will send an iMessage to the phone number 123-555-1234 containing the text "Hello there!".

sendMessage.applescript:

on run {targetBuddyPhone, targetMessage}     tell application "Messages"         set targetService to 1st service whose service type = iMessage         set targetBuddy to buddy targetBuddyPhone of targetService         send targetMessage to targetBuddy     end tell end run 
like image 191
Senseful Avatar answered Oct 14 '22 11:10

Senseful