cre*_*eve 18 applescript messages send imessage
有人可以告诉我如何通过消息应用程序直接向iMessage用户发送消息吗?
tell application "Messages"
if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 1
if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 2
if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 3
send "Message" to buddy "mail of name" of service x
end tell
Run Code Online (Sandbox Code Playgroud)
我只需要通过iMessage向帐户发送消息,而不是通过Google Talk,AIM,bonjour.谢谢!
Sen*_*ful 46
您无需对iMessage服务进行硬编码,而是可以自动找到它:
sendMessage.applescript(注意:确保选择" 文本"选项).osascript sendMessage.applescript 1235551234 "Hello there!".sendMessage.applescript:
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
end tell
end run
Run Code Online (Sandbox Code Playgroud)
小智 10
据我所知,你无法通过AppleScript开始新的对话.因此,好友和服务必须结合在一起,并且必须进行持续的对话.
如果您有好友的名字,您可以执行以下操作
tell application "Messages"
get name of service of buddy "Buddy Name"
end tell
Run Code Online (Sandbox Code Playgroud)
这将返回适合好友的服务名称.当然,您也可以使用服务ID.但我喜欢用这个名字.
最后,您将能够发送消息
tell application "Messages"
send "Text of Message" to buddy "+43 555 XXXXXXX" of service "E:example@mac.com"
end tell
Run Code Online (Sandbox Code Playgroud)
此脚本将每隔10~30秒发送一条消息
tell application "Messages"
set targetBuddy to "+12025551234"
set targetService to id of 1st service whose service type = iMessage
repeat
set textMessage to "Hi there!"
set theBuddy to buddy targetBuddy of service id targetService
send textMessage to theBuddy
delay (random number from 10 to 30)
end repeat
end tell
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
47189 次 |
| 最近记录: |