Send Multiple Messages through the Terminal with the iMessage App!
Andres Haro
Posted on September 6, 2020
If you would like to learn a quick and fun trick, you will need to do the following:
- Get an AppleScript to be able to open the iMessage app:
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
send targetMessage to targetBuddy
say targetMessage
end tell
end run
Create a TXT file that will have some lines of text
Create a new Python file: In this python file, you will have to use two different libraries OS, & Config
import os
import config
def get_words(file_path):
with open(file_path, 'r') as f:
text = f.readlines()[0]
words = text.split()
return words
def get_lines(file_path):
with open(file_path, 'r') as f:
text = f.readlines()
return text
def send_message(phone_number, message):
os.system('osascript send.scpt {} "{}"'.format(phone_number, message))
if __name__ == '__main__':
#words = get_words('ly.txt')
#for word in words:
#send_message('6197516857', word)
text = get_lines('ly.txt')
for line in text:
send_message('18012321787', line)
After that, you will have to run the script inside the terminal.
python3 main.py
Look at my GitHub repository:
💖 💪 🙅 🚩
Andres Haro
Posted on September 6, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.