2011-05-19 96 views
0

我正在写一个脚本,每次联系人登录Adium时都会启动该脚本。 我的目标是在某些朋友登录时出现咆哮消息。 一切正常,只是我不知道如何从刚刚签署的接触得到的“显示名称”Adium Applescript咆哮通知

这里是代码:

告诉应用程序“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 

末告诉

回答

0

当有人登录时,似乎没有任何事件可以挂钩。实际上,Adium根本没有暴露给appleScript的事件。如果你现在需要这个功能,你可能需要维护一个登录成员列表,然后定期进行轮询。如果出现新的缺口,那将是一个咆哮的人。这不是太难,但是定期的轮询需要一个可以在后台运行的appleScript应用程序,以及一个空闲的事件,这不是你想要听到的,我确定。

对不起没有更好的消息,但这是appleScript的一个相当典型的问题:你受到第三方应用程序开发人员的支配,在字典中包含有用的东西。他们通常都没有,但只是感谢有一本字典!

稍好的消息是:Adium和Growl都已经有了appleScript字典,并且都是开源的。 (Adium是GPL,Growl是BSD)。这意味着您有可能影响开发人员为Adium实现一些事件处理程序,但也意味着您无法命令截止日期。你有没有尝试加入Adium开发者论坛?

1

但您可以在联系人登录时启动脚本。该脚本可以检查名称,如果它与您想要的名称匹配,会给您留言