How could I list all contacts in an existing group ?
(pythonista contacts module)
I would like to write a script that provides me with all email addresses in a contacts-group to use in emailing the group in one action.
How could I list all contacts in an existing group ?
(pythonista contacts module)
I would like to write a script that provides me with all email addresses in a contacts-group to use in emailing the group in one action.
I just realized that the documentation for this is missing, but Group objects have a get_members method that returns a list of all contained Person objects.
;-) Thanks a lot
@omz If it's missing in the Pythonista docs does it exist in Editorial? (Or is the module not present in Editorial?)
You can run this code to find out if the contacts module is present and if it contains a get_members() method.
import inspect, contacts
print('=' * 20)
groups = contacts.get_all_groups()
if groups:
for member in inspect.getmembers(groups[0]):
print(member[0])
else:
print('You have no groups!')
The whole contacts module is not yet available in Editorial.
I was wondering why when I do contacts.find('anyname') I always get 2 person objects returned for each result found by the Contacts.app.
Does this only happen to me (duplicate objects returned) or is this expected?
OK, further experimentation has demonstrated to me that I have duplicates of all contacts (I added one and it displayed properly). Can anyone tell me: 1. how does this happen? 2. does the Contacts.app only show one copy? 3. most importantly, is there a simple way to remove the duplicates?