@cvp Brilliant! Thank you so much. My first script is complete and is working beautifully. :) Even better than that is I learned something!
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Latest posts made by my4paws
-
RE: Add contact to a group?
-
RE: Add contact to a group?
Thanks for your reply, I’m kanda hoping that’s not the case though.
The documents covers the following:
———————
A Group object represents a group in the address book, e.g. friends, family, or co-workers. After initializing a Group object and setting its name attribute, it can be added to the address book database by calling add_group(). When a group’s name is modified, the save() function has to be called in order to make the change persistent.Group.name
The group’s name, e.g. ‘Friends’ or ‘Family’.Group.id
The persistent identifier of the group record in the address book (int, readonly), or -1 if the group has not been saved yet. The id can be used with the get_group() function.——————
Somewhere else I’ve seen mention of an “add_member” function too, which perhaps implies it might be possible?
@ccc said:
Python
introspection
to the rescue...import contacts print(dir(contacts.get_all_groups()[-1])) # dir(the last Group in Contacts)
Group has three methods
add_member()
,get_members()
, andremove_member()
. -
Add contact to a group?
My first question here and just getting started so please be kind.
The task I’ve set myself is to automatically extract contact information from a stack of pdf registration forms, and to create new IOS contacts with that extracted information.
I’ve used (apple) workflow to get the text elements from the PDFs, and have cobbled together the code below from snippets found here that use the contacts module provided in pythonista to create a new contact in IOS.
All good so far.... however now I’m stuck and looking for some clues on how to add the contact to a particular group in IOS contacts, namely “Customers”
The documentation doesn’t seem to cover this in a way I’m able to understand and there are no examples I can find either here or elsewhere on the web showing how to use the contact.group element to add a new member to a group.
What I’ve got so far is here:[https://gist.github.com/my4paws/ae7dc32ba9937996d4d13848ab13404c](link url)
Note: I wasn’t able to post the code directly here without being flagged as spam.Any help much appreciated.
-
Post content being marked as Spam??
Spent a good while composing a detailed question only to have my post rejected as Spam. Absolutely nothing in the content of the post was remotely spam like. No links, no swearing, no emoticons, no images, good use of punctuation, grammar, code placed in within provided code section.
What gives? -
RE: Pythonista script included in Workflow
Hi
I’m also new to python and reading through the forum here looking for help building my first script. I’ve yet to ask a question here. That no one has given you an answer in 21 days for what is I’m sure pretty basic stuff for most users of this forum doesn’t bode well for us beginners does it. :(
But anyway... you can achieve your aim within just workflow quite easily with the following sequence of actions.Get file
Set variable
Save file ( with new name)
Get variable
Delete file