Ever want to send a text message but you don’t have the energy to send it one word at a time? If you have macOS signed into iMessage, you can use AppleScript to automate sending one word at a time! (Warning: Doing this more than a few times will probably get you blocked by the people you know!)
(The below script is available at send_message.applescript)
#!/usr/bin/env osascript
# CREDIT TO https://chrispennington.blog/blog/send-imessage-with-applescript/ for how to send iMessages via AppleScript
on run parameters
# the number here is the number of seconds
set theDelay to 3
# Change this to the phone number of the iMessage contact to use
set phoneNumber to "+1 (555) 555-1212"
tell application "Messages"
set targetBuddy to phoneNumber
set targetService to id of 1st account whose service type = iMessage
repeat with arg from 1 to length of parameters
set textMessage to ( item arg of parameters )
set theBuddy to participant targetBuddy of account id targetService
send textMessage to theBuddy
delay theDelay
end repeat
end tell
log "Message sent"
end run
The repeat with arg from 1 to length of parameters
and end repeat
is essentially AppleScript’s for
loop, with arg
being the loop variable and 1
to length of parameters
being the closed range on 1 to the end of the parameters
list. Changing the value of theDelay
can separate the messages by different number of seconds (currently 3 seconds)
You need to chmod +x
the script and update the phone number and then you can run it like:
./send_message.applescript This is a message to send
![Results of running AppleScript
This is a [Read 1:49PM] message to send with one blue bubble on each line](https://thomaspowell.com/wp-content/uploads/2022/09/image-3.png)
You can group words with quotes as well
./send_message.applescript "This is a" "message to send"

Remember: Use / abuse of this script may get you blocked. This script is purely for educational purposes.