简体   繁体   English

铝Applescript低吼通知

[英]Adium Applescript Growl Notification

I am writing a script that is initiated every time a contact signs on to Adium. 我正在编写一个脚本,每次联系人登录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" 告诉应用“ 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 结束告诉

但是您可以在联系人登录时启动脚本。该脚本可以检查姓名,如果名称与您想要的名称匹配,则会大声喊叫

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. 当有人登录时,似乎没有任何事件可以挂入。实际上,Adium根本没有任何事件暴露给appleScript。 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. 这并不太难,但是我敢肯定,定期轮询需要可以在后台运行的appleScript应用程序和一个空闲事件,这不是您想要听到的。

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. 抱歉,没有更好的消息,但这是AppleScript的一个非常典型的问题:您受第三方应用程序开发人员的委托,无法在字典中包含有用的内容。 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和Growl都已经有了appleScript词典,并且都是开源的。 (Adium is GPL, Growl is BSD). (Adium是GPL,Growl是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. 这意味着您有机会影响开发人员为Adium实现某些事件处理程序,但是您也无法命令截止日期。 Have you tried joining the Adium developer forums? 您是否尝试过加入Adium开发者论坛?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM