0
我很想從命令行發送我的Adium聯繫人消息。語法應該看起來像echo test | im <contact>
。我已經採取並修改了this script來做我想做的事情,但它有點老,我正在嘗試對其進行現代化。到目前爲止,我已經得到了這個工作(我只是改變了AppleScript的,在這裏。)Adium從蘋果發送兩條聊天消息
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中做錯了?
從[Adium的AppleScript文檔](http://trac.adium.im/wiki/AppleScript_Support_1.2)判斷,您的腳本可能可以簡化,但我看不到任何可能導致雙重發送的內容。 OTOH,[沒有Adium漏洞聽起來像你的問題那樣的票](http://trac.adium.im/query?status=assigned&status=new&status=pending&description=%7EApplescript&group=type&col=id&col=summary&col=status&col=所有者COL =類型&COL =里程碑&順序=優先級)。我想知道在您的特定配置中是否有問題導致問題(可能會創建雙重聊天會話)? – kopischke