Adium Applescript 咆哮通知
我正在编写一个脚本,每次联系人登录 Adium 时都会启动该脚本。 我的目标是当某些朋友登录时出现咆哮消息。 一切正常,除了我不知道如何从刚刚登录的联系人获取“显示名称”。
以下是代码:
tell application "Adium"
#Get the alias of the contact that just signed on:
get display name of contact #most recently signed in (HOW DO I RESPRESENT THIS)
#Jon
if display name of contact is "Jon" then
tell application "GrowlHelperApp"
-- Make a list of all notification types:
set the allNotificationsList to ¬
{"Jon"}
-- Make a list of the default enabled notifications:
set the enabledNotificationsList to ¬
{"Jon"}
-- Register the script with Growl
register as application ¬
"AdiumFriends" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "AdiumFriends"
-- Send a notification:
notify with name ¬
"Jon" title ¬
"Jon signed on" description ¬
¬
"Facebook" application name "AdiumFriends"
end tell
end if
end Tell
I am writing a script that is initiated every time a contact signs on to Adium.
My goal is for a growl message to appear when certain friends log on.
Everything works except I do not know how to get the "display name" from the contact that just signed in.
Here is the code:
tell application "Adium"
#Get the alias of the contact that just signed on:
get display name of contact #most recently signed in (HOW DO I RESPRESENT THIS)
#Jon
if display name of contact is "Jon" then
tell application "GrowlHelperApp"
-- Make a list of all notification types:
set the allNotificationsList to ¬
{"Jon"}
-- Make a list of the default enabled notifications:
set the enabledNotificationsList to ¬
{"Jon"}
-- Register the script with Growl
register as application ¬
"AdiumFriends" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "AdiumFriends"
-- Send a notification:
notify with name ¬
"Jon" title ¬
"Jon signed on" description ¬
¬
"Facebook" application name "AdiumFriends"
end tell
end if
end tell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
但您可以在联系人登录时启动一个脚本。该脚本可以检查姓名,如果它与您想要的相符,它会给您一个喊叫
but you can start a script when a contact logged in. That script could check the name and if it matches with your desired it'll give you a shout
当有人登录时,似乎没有一个事件可以挂钩。实际上,Adium 根本没有向 appleScript 公开任何事件。如果您现在需要此功能,您可能必须维护登录成员的列表,然后定期轮询。如果出现一个新的昵称,那将是一个值得咆哮的昵称。这并不太难,但是定期轮询需要一个可以在后台运行的 appleScript 应用程序,以及一个空闲事件,我确信这不是您想听到的。
抱歉没有更好的消息,但这是 appleScript 的一个相当典型的问题:您受 3rd 方应用程序开发人员的摆布,在字典中包含有用的内容。他们常常不这样做,但要庆幸有一本字典!
稍微好一点的消息是:Adium 和 Growl 都已经有了 appleScript 字典,而且都是开源的。 (Adium 是 GPL,Growl 是 BSD)。这意味着您有机会影响开发人员为 Adium 实现一些事件处理程序,但您也无法指定最后期限。您是否尝试过加入 Adium 开发者论坛?
There doesn't appear to be an event to hook into when somebody signs in. Actually, Adium has no events exposed to appleScript at all. If you need this functionality now, you'll probably have to maintain a list of members-signed-in, and then poll regularly. If a new nick appears, that would be the one to growl about. This is not too hard, but regular polling requires an appleScript app which can run in the background, and an idle event, which is not what you want to hear, I am sure.
Sorry not to have better news, but it is a rather typical problem with appleScript: You are at the mercy of the 3rd party app developers to include useful stuff in the dictionary. All too often they don't, but just be thankful there is a dictionary at all!
The slightly better news is this: Both Adium and Growl already have appleScript dictionaries, and both are open source. (Adium is GPL, Growl is BSD). That means that there's a chance you can influence the developers to implement some event handlers for Adium, but also that you can't command a deadline. Have you tried joining the Adium developer forums?