我将在与iPhone相连的MacBook笔记本电脑上使用AppleScript发送一整条个人短信。
如果创建一条消息,则将其手动复制粘贴到消息中,然后手动发送出去,一次只发送一条消息(复制粘贴消息,复制粘贴电话号码,发送)就可以了。我可以轻松地在草稿中格式化邮件,并且保留格式。如果我尝试通过脚本执行此操作,则换行会丢失。
所需消息:
大家好,
这将是星期五上午10点举行的特别会议。请致电小组会议,访问热线xxxxxxxxxxx
讨论主题:季度销售。
大家好,本季度销售旺盛;所有yippee,得到加薪。在会议上共享的细节。
再次感谢所有人
苏珊,销售经理
这就是它的到达方式。
大家好,这将是一次特别的会议,星期五,上午10点。请致电小组会议,访问热线xxxxxxxxxxx讨论主题:季度销售。大家好!本季度销售旺盛。我们都在加薪,yippee。在会议上共享的细节。再次感谢所有苏珊,销售经理
这是appleScript:
set textMessage to "Hello Everybody,\n\nThis is going to be a special meeting taking place
on Friday, 10AM. Please call in to the group meeting, access line xxxxxxxxxxx\n\nTopic
of Discussion: Quarterly Sales. \n\nGreat Job everybody, Sales are thru the roof this
quarter; We're all getting pay raises, yippee. Details shared at the meeting.
\n\nAgain, thanks to all \n\nSusan, \nSales Manager\n"
set phonelist to {"1999-555-6850", "1999-555-9496", "1999-555-7170", "1999-555-4445",
"1999-555-1182", "1999-555-7463", "1999-555-1809", "1999-555-8916", "1999-555-5139",
"1999-555-5252", "1999-555-6646", "1999-555-3642", "1999-555-2437", "1999-555-0755",
"1999-555-8732", "1999-555-6202", "1999-555-0310", "1999-555-7410", "1999-555-3300",
"1999-555-0655"}
set i to 0
activate application "Messages"
tell application "System Events" to tell process "Messages"
repeat with indPhone in phonelist
set i to i + 1
key code 45 using command down -- press Command + N to start a new window
keystroke indPhone -- input the phone number
delay 1
key code 36
key code 36 -- press Enter to focus on the message area
keystroke textMessage -- type some message
delay 1
key code 36 -- press Enter to send
say i
delay 5 -- Audio plus delay = success tracking.
-- If for some reason something goes wrong, I know where I am.
-- e.g. phone rings during the process.
end repeat
end tell
注意:reference。
注#2。哦,请注意,这不是实际发送的消息。这只是StackOverflow的人为示例。接收消息的听众只是不明白当有人回复组消息时会发生什么。他们只是不明白,叹了口气。所以不,组文本页面不是答案。我们想要个人短信,每人一条。但是,谢谢你的建议。通常,一次使用这种技术发送的消息少于100条。
关于它为什么作为脚本运行时为什么会丢失\n
格式的任何想法?如果您在Mac上运行此确切的脚本,会看到相同的结果吗?
编辑:我将通过电话分享一些屏幕截图。
我想要的(通过手动复制创建并粘贴到“邮件”应用中):
这是上面的脚本(/n/n
)所提供的:
这就是我用RobC & return &
技术所得到的。 (查看评论)
此代码有效(部分改编自here):
set textMessage to "Hello Everybody,
This is going to be a special meeting taking place
on Friday, 10AM. Please call in to the group meeting, access line xxxxxxxxxxx
Topic
of Discussion: Quarterly Sales.
Great Job everybody, Sales are thru the roof this
quarter; We're all getting pay raises, yippee. Details shared at the meeting.
Again, thanks to all
Susan,
Sales Manager
"
set phonelist to {"1999-555-6850", "1999-555-9496", "1999-555-7170", "1999-555-4445",
"1999-555-1182", "1999-555-7463", "1999-555-1809", "1999-555-8916", "1999-555-5139",
"1999-555-5252", "1999-555-6646", "1999-555-3642", "1999-555-2437", "1999-555-0755",
"1999-555-8732", "1999-555-6202", "1999-555-0310", "1999-555-7410", "1999-555-3300",
"1999-555-0655"}
repeat with indPhone in phonelist
tell application "Messages"
set targetService to (id of 1st service whose service type = iMessage)
set theBuddy to buddy ("+1" & indPhone) of service id targetService
send textMessage to theBuddy
end tell
end repeat