Applescript question, deleting inactive contacts
Steve Schow
steve at bstage.com
Wed Jan 23 21:06:25 UTC 2013
I am trying to write an applescript that will go through all the 1000+ contacts that have accumulated, and delete the ones which are no longer active. I have maybe 100 active contacts. By active I mean, they are currently an "added" yahoo user on my yahoo contact list that I see. When I remove a contact, adium seems to keep the contact object internally anyway, just in case I might add that contact again, then their complete info will still be there. I want to completely nuke the ones that are not active anymore.
So the question is, in Applescript when I'm looking at a contact object, how can I determine if that contact is currently on my actual yahoo contact list, as opposed to just lurking in the plist?
Here is some code I have so far:
-----------
tell application "Adium"
repeat with eachAccount in every account of service "Yahoo!"
set allContacts to get every contact of eachAccount
repeat with eachContact in allContacts
set dName to the display name of eachContact
set uName to the name of eachContact
if (exists contact uName) then
set existsStatus to "TRUE"
else
set existsStatus to "FALSE"
end if
if (blocked of eachContact) then
set blockedStatus to "TRUE"
else
set blockedStatus to "FALSE"
end if
-- NEEDED HERE HOW TO DETERMINE ACTIVE CONTACT
-- Display a confirmation box for deleting the contact permanently
set question to display dialog "User=" & dName & " " & uName & "
Exists=" & existsStatus & "
Blocked=" & blockedStatus & "
Do you want to delete?" buttons {"Yes", "No"} default button 2
set answer to button returned of question
if answer is equal to "Yes" then
-- delete it
end if
end repeat
end repeat
end tell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20130123/999bfd39/attachment-0002.html>
More information about the devel
mailing list