在MAC OS系統上Apple公司提供一種叫Apple script的腳本來自動實現任務。
實現iMessage群發的Apple script腳本代碼如下:
tell application "Messages" set csvDatatoread "/Users/dengzhenhua/Desktop/send.txt" set csvEntriestoparagraphsofcsvData repeat with ifrom 1tocountcsvEntries set phone to (csvEntries'sitemi)'stext set myid to get idof firstservice set theBuddy to buddyphoneof serviceidmyid send "今天北京晴,氣溫13到27度;周二晴,氣溫11到26度,北風3-4級;周三晴,氣溫11到24度,微風<3 ---- 品絡互聯 www.pinluo.com"totheBuddy delay 1 set FailNum to (getcountchat) if FailNum > 100 then repeat withjfrom 1 to FailNum setphoneto (getnameof chat (FailNum -j)) setDelMsgto "iMessage;-;" &;phone ifexists (text chatidDelMsg)then deletetext chatidDelMsg end if end repeat end if end repeat end tell
代碼 應該是沒錯,但是運行 抱錯 如下。
解決辦法:
解決方法是:
如上圖,依次打開:信息 - 偏好設置 - 賬戶,如果列表有多個賬戶,那么就把要做發送賬戶的那個賬戶拖動移到最上面,這樣腳本就會默認用第一個賬戶去發送了。
我之前就是因為第一個賬戶不能發,而后面幾個都能發,導致出現了下面錯誤:“iMessage遇到一個錯誤:不能獲得“buddy id "C0B35E7F-A0FB-49E1-BDD7-C867BC06D920:+86136xxxx0000"”
把能發送的賬戶拖動到第一個就好了。