我很想从命令行发送我的 Adium 联系人消息。语法应该看起来像echo test | im <contact>
. 我已经采用并修改了这个脚本来做我想做的事,但它有点旧,我正在尝试对其进行现代化改造。到目前为止,我已经完成了这项工作(我只更改了 applescript,在这里。)
set stdinText to do shell script "echo \"\$MESSAGE\"" without altering line endings
tell application "Adium"
set user to get contact "$BUDDY"
if not (exists (chats whose contacts contains user)) then
if not (exists (first chat window)) then
tell account of user
set new_chat to make new chat with contacts {user} with new chat window
end tell
else
set existing_window to first chat window
tell account of user
set new_chat to make new chat with contacts {user} in window existing_window
end tell
end if
else
set new_chat to first chat whose contacts contains user
end if
send new_chat message stdinText
end tell
效果很好,只是聊天消息发送了两次。这是 Adium 中的错误还是我在 applescript 中做错了什么?