Если вы хотите изучить быстрый и забавный трюк, вам нужно будет сделать следующее:
- Получите AppleScript, чтобы открыть приложение imessage:
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
Создайте файл TXT, который будет иметь несколько строк текста
Создайте новый файл Python: в этом файле Python вам придется использовать две разные библиотечные ОС, & 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)
После этого вам придется запустить сценарий внутри терминала.
python3 main.py
Посмотрите на мой репозиторий GitHub:
Отправить сообщение – репозиторий
Оригинал: “https://dev.to/hvaandres/send-multiple-messages-through-the-teminal-with-the-imessage-app-5d87”