码迷,mamicode.com
首页 > 系统相关 > 详细

MAC使用imessage自动发消息

时间:2015-04-16 15:44:16      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:ios   applescript   imessage   

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

//csv文件内容

189*****773;hello1

189*****773;hello2

189*****773;hello3

189*****773;hello4

打开脚本编辑器

tell application "Messages"

set the this_folder to path to desktop folder as alias

set thefullpath to POSIX path of this_folder

set csvData to read thefullpath & "/test.csv"

set csvEntries to paragraphs of csvData

set targetService to id of 1st service whose service type = iMessage

repeat with i from 1 to count csvEntries

set potion to (offset of ";" in (csvEntries‘s item i)‘s text)

set phone to text 1 thru (potion - 1) of (csvEntries‘s item i)‘s text

set messageBody to text (potion + 1) thru -1 of (csvEntries‘s item i)‘s text

set theBuddy to buddy phone of service id targetService

send messageBody to theBuddy

end repeat

end tell

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


MAC使用imessage自动发消息

标签:ios   applescript   imessage   

原文地址:http://blog.csdn.net/djlycit/article/details/45075721

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!