如何发送带有一个的AppleScript文字即时聊天,只有在提供服务? [英] How to send an imessage text with applescript, only in provided service?
本文介绍了如何发送带有一个的AppleScript文字即时聊天,只有在提供服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人能告诉我如何直接通过消息应用程序中发送消息到的iMessage用户?
Can somebody show me how to send a message directly to the user of iMessage via Messages app?
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
我只需要通过的iMessage,而不是通过谷歌对话,AIM,卓悦将消息发送到帐户。
谢谢!
I need to send a message to an account only via iMessage, not via google talk, AIM, bonjour. Thank you!
推荐答案
而不必硬code中的的iMessage服务,可以自动找到它:
Instead of having to hard-code the iMessage service, you can find it automatically:
- 将以下脚本保存为
sendMessage.applescript
(注意:一定要选择在文本选项)。 - 运行执行它。
osascript sendMessage.applescript 1235551234
- 这一个的iMessage发送至电话号码123-555-1234包含文本你好!。
您好!有:
- Save the following script as
sendMessage.applescript
(Note: make sure to choose the Text option). - Execute it by running:
osascript sendMessage.applescript 1235551234 "Hello there!"
. - This will send an iMessage to the phone number 123-555-1234 containing the text "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
这篇关于如何发送带有一个的AppleScript文字即时聊天,只有在提供服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文