MAC使用imessage自动发消息

来源:互联网 发布:php 邀请码注册数据库 编辑:程序博客网 时间:2024/06/05 08:09

用excel建一个csv文件,第一个字段为号码,第二个字段为内容

//csv文件内容

189*****773;hello1

189*****773;hello2

189*****773;hello3

189*****773;hello4

打开脚本编辑器

tell application "Messages"

set the this_folderto path todesktop folder asalias

set thefullpathto POSIX path of this_folder

set csvDatato readthefullpath & "/test.csv"

set csvEntriesto paragraphsof csvData

set targetServiceto id of 1stservice whoseservice type = iMessage

repeat with ifrom 1 to countcsvEntries

set potion to (offsetof ";" in (csvEntries'sitem i)'stext)

set phone to text 1thru (potion - 1)of (csvEntries'sitem i)'stext

set messageBody to text (potion + 1)thru -1 of (csvEntries'sitem i)'stext

set theBuddy to buddyphone of service idtargetService

sendmessageBody totheBuddy

end repeat

end tell

代码很简单没什么可讲的,测试通过


0 0