2011-05-19 68 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

但您可以在聯繫人登錄時啓動腳本。該腳本可以檢查名稱,如果它與您想要的名稱匹配,會給您留言