AppleScript Support
BusyContacts for Mac includes an AppleScript automation API covering the same 33 contact commands available in the AI & MCP Server, plus get URL for opening busycontacts:// links. You can list address books, tags, and Smart Filters, search contacts, check upcoming birthdays and anniversaries, read mail and calendar activity metadata, create or patch cards, edit individual fields, manage notes and tags, compare address books, import and export vCards, and work with photos directly from a script. Changes save through BusyContacts' editing pipeline and sync through your connected accounts.
BusyContacts' AppleScript support is Mac-only and requires macOS 13.5 or later. AppleScript uses normal macOS Apple Events authorization (System Settings > Privacy & Security > Automation) and does not require turning on the MCP server in Settings > Automation.
For visual workflows and voice actions, see Siri and Shortcuts. For AI assistants such as Claude, Codex, ChatGPT, or Gemini, see AI & MCP Server.
Getting Started
Open Script Editor (in /Applications/Utilities) and paste any of the examples below to try them out.
Call all commands inside a tell application "BusyContacts" block. Each command accepts labeled parameters after given and returns an AppleScript record with camelCase user-labeled keys. Every automation command supports both a camelCase name and a spaced lowercase synonym (for example, searchContacts or search contacts, createContact or create contact). This guide uses the spaced names in examples for readability.
tell application "BusyContacts"
set resultRecord to list address books given writableOnly:true
return |items| of resultRecord
end tell
You can also run scripts from Terminal using osascript:
osascript -e 'tell application "BusyContacts" to list address books'
For multi-line scripts, save the script to a file (for example contacts.applescript) and run:
osascript contacts.applescript
Data commands do not open or activate a BusyContacts window; only open contact and show smart filter bring up or change the app window. If BusyContacts is still starting up when a script runs, the command waits until the contacts database is ready before executing.
Input records (contact, changes, field, and items inside updates) must use user-labeled camelCase keys. Wrap record keys in vertical pipes (|...|) when building input records and when reading fields from returned records, especially for AppleScript reserved words like |id|, |name|, |text|, |date|, and |items|. Passing an unpiped standard AppleScript property keyword (such as name: instead of |name|:) rejects the entire command with invalidArguments rather than silently ignoring the key.
Record Values, Dates, and Nulls
BusyContacts maps AppleScript values onto its contact schema with strict type checks:
- Null values (
missing value): Usemissing valueto clear nullable scalar fields inupdate contact/update contacts, clear structured address or profile components inupdate contact field, clear the primary image inset contact photo(inputFile:missing value), or represent a birthday or custom date without a year ({|year|:missing value, |month|:12, |day|:10}). Omitting a key preserves its current value. Returned null properties (such asnextOffseton the last page oragewhen no birth year is stored) also appear asmissing value. - Timestamps vs. calendar days:
- Timestamp parameters (
createdSinceandmodifiedSinceonsearch contactsandlist contacts, plusstartandendonquery activity) accept either a real AppleScriptdate(such as(current date) - (7 * days)) or an ISO 8601 string withZor an explicit offset (such as"2026-11-01T00:00:00Z"). Passing an AppleScriptdateto any other parameter is rejected. - Calendar-day parameters (
birthdayStart,birthdayEnd, andlist upcoming datesstart/end) take GregorianYYYY-MM-DDtext strings with an optional IANAtimeZonestring (such as"America/New_York"or"UTC"). - Returned dates:
createdAt,modifiedAt, and activitydateare returned as real AppleScriptdatevalues.occursOnis returned asYYYY-MM-DDtext, andContactDatevalues use{|year|:..., |month|:..., |day|:...}.
- Timestamp parameters (
- Lists and numbers: Array parameters take AppleScript lists (
{"Client", "VIP"}), and integers must fit in 32-bit signed integers. Unknown keys in input records are rejected (invalidArguments).
Command Summary
Utility:
get URL: open abusycontacts://URL action
Discovery and reading:
list address books(listAddressBooks): list eligible address books, accounts, and write accesslist tags(listTags): list tags and distinct eligible physical-card countslist smart filters(listSmartFilters): list saved Smart Filters without activating themlist contacts(listContacts): enumerate physical or merged contacts with structured filterssearch contacts(searchContacts): search contacts by free text and structured filtersget contact(getContact): fetch a contact (or"me") and its accessible linked cardsselected contacts(selectedContacts): read the contacts currently selected in the main windowlist upcoming dates(listUpcomingDates): list upcoming birthdays, anniversaries, and custom datesquery activity(queryActivity): read Apple Mail and BusyCal activity metadata for a contactcompare address books(compareAddressBooks): find cards in one address book missing from anotherparse contact text(parseContactText): preview Quick Entry parsing without saving
Creating and editing:
create contact(createContact): create a structured person or company cardcreate contact from text(createContactFromText): parse Quick Entry text and create a cardupdate contact(updateContact): patch scalar properties on one physical cardupdate contacts(updateContacts): patch 1 to 100 physical cards atomicallyadd contact field(addContactField): add one typed field row and return its field recordupdate contact field(updateContactField): patch one exact field row byfieldIDremove contact field(removeContactField): remove one exact field row byfieldIDappend note(appendNote): append plain text (optionally dated or private) to a card's noteadd tags(addTags): add tags to 1 to 100 physical cardsremove tags(removeTags): remove exact tags from 1 to 100 physical cardsduplicate contact(duplicateContact): duplicate a physical card into the same or another book
Organizing, linking, and deleting:
move contacts(moveContacts): move 1 to 100 physical cards to another writable address booklink contacts(linkContacts): link 2 to 100 physical cards without merging their dataunlink contacts(unlinkContacts): remove local links for selected physical cardsmerge contacts(mergeContacts): merge physical cards and return surviving cards and transitionsdelete contacts(deleteContacts): delete 1 to 100 physical cards
Import, export, and photos:
export contacts(exportContacts): export up to 500 cards as vCard 3.0 (inline text or file)import contacts(importContacts): import vCard text or a vCard file into a writable address bookget contact photo(getContactPhoto): read a contact's primary photo or logo as PNGset contact photo(setContactPhoto): set or clear a contact's primary image
Navigation:
open contact(openContact): reveal a physical card in the main window or a floating Info windowshow smart filter(showSmartFilter): activate a saved Smart Filter in the main window
Identity, Scope, and Permissions
BusyContacts returns edition-scoped opaque identifiers across all automation surfaces:
| Prefix | Identifies | Notes |
|---|---|---|
bcc1.… | Physical contact card | Required by all write commands. "me" is accepted only by get contact. |
bcf1.… | Individual field row | Returned on contact reads and add contact field (|id| of |field| of result). |
bcb1.… | Address book | Returned by list address books. |
bca1.… | Account | Returned inside address book records. |
bcs1.… | Saved Smart Filter | Returned by list smart filters. |
bct1.… | Tag | Returned by list tags. |
Keep these rules in mind when scripting BusyContacts:
- Merged reads vs. physical writes:
search contactsandget contactmerge accessible linked sets by default, whilelist contactsdefaults to physical cards (view:"physical"). Every write command targets explicit physical card IDs (bcc1.…). Moving or merging contacts can create new card IDs returned inidTransitions; update any saved IDs fromidTransitionsor refetch the contact after moves, merges, or sync refreshes. - Address book permissions and excluded sources: Read-only address books reject edits to synced fields (
readOnlyContactorreadOnlyAddressBook), and sources excluded in BusyContacts' source list stay hidden from scripts. Unchecked address books remain readable unless their source is excluded. Group cards are omitted from ordinary contact queries. - Private fields (
My NotesandMy Tags): Omitted from searches, reads, and tag counts unless you passincludePrivate:true. - Contact activity access:
query activityrequires Share contact activity with automation to be turned on in BusyContacts > Settings > Integrations. It returns metadata only (never message bodies) and never launches BusyCal. - Destructive commands run directly: Unlike Siri and Shortcuts, AppleScript commands such as
delete contactsandmerge contactsdo not display an interactive confirmation sheet in BusyContacts. Double-check target IDs before running destructive scripts.
Utility
get URL
Opens a busycontacts:// URL, just like clicking a BusyContacts link. See URL Handler for supported URL formats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| Direct parameter | Text | Yes | The busycontacts:// URL to open (for example busycontacts://show/ada@example.com or busycontacts://new/...). |
tell application "BusyContacts"
get URL "busycontacts://show/ada@example.com"
end tell
Discovery and Reading
list address books
Primary name: listAddressBooks · Synonym: list address books
Returns eligible address books, their owning accounts, and write-access flags (read_only, read_write, or owner).
| Parameter | Type | Required | Description |
|---|---|---|---|
accountID | Text | No | Restrict results to one eligible account (bca1.…). |
writableOnly | Boolean | No | Return only address books that allow creating contacts. |
offset | Integer | No | Pagination offset (0 to 100000, default 0). |
limit | Integer | No | Maximum items to return (1 to 500, default 50). |
list tags
Primary name: listTags · Synonym: list tags
Returns tags and the number of distinct eligible physical cards carrying each tag.
| Parameter | Type | Required | Description |
|---|---|---|---|
addressBookIDs | List of Text | No | Count memberships only inside these address books. |
scope | Text | No | "global" (default), "local", or "both". "local" and "both" require includePrivate:true. |
includePrivate | Boolean | No | Opt in to My Tags. Default: false. |
offset | Integer | No | Pagination offset. |
limit | Integer | No | Maximum items to return (1 to 500, default 50). |
list smart filters
Primary name: listSmartFilters · Synonym: list smart filters
Returns your saved Smart Filters (including remembersAddressBooks, requiresPrivate, and addressBookIDs when remembered) without activating them in the BusyContacts window.
| Parameter | Type | Required | Description |
|---|---|---|---|
offset | Integer | No | Pagination offset. |
limit | Integer | No | Maximum items to return (1 to 500, default 50). |
list contacts
Primary name: listContacts · Synonym: list contacts
Enumerates eligible contacts using structured filters without free-text search. Defaults to physical cards (view:"physical").
| Parameter | Type | Required | Description |
|---|---|---|---|
view | Text | No | "physical" (default) or "merged". |
addressBookIDs | List of Text | No | Restrict to these address books. |
smartFilterID | Text | No | Intersect with a saved Smart Filter (bcs1.…). |
tagsAny, tagsAll, tagsExactly | List of Text | No | Match contacts carrying any, all, or exactly these tag names. |
tagScope | Text | No | "global" (default), "local", or "both" (local/both require includePrivate:true). |
company, email, phone | Text | No | Exact company, normalized email, or phone match. |
phoneCountry | Text | No | ISO region code for interpreting phone (for example "US" or "GB"). |
hasFields, lacksFields | List of Text | No | Require presence or absence of field kinds (phone, email, url, address, date, related_name, social_profile, instant_message, custom). |
birthdayStart, birthdayEnd | Text | No | Both required together: recurring Gregorian window (YYYY-MM-DD, end exclusive). |
createdSince, modifiedSince | Date or Text | No | Inclusive lower bounds on timestamps (AppleScript date or zoned ISO 8601 text). |
sort | Text | No | "display_name" (default), "first_name", "last_name", "company", "created_at", or "modified_at". |
descending | Boolean | No | Reverse primary sort order (ID tie-break stays ascending). |
includePrivate | Boolean | No | Include My Notes and My Tags in matching and output. Default: false. |
timeZone | Text | No | IANA time zone for day-based filters (for example "UTC"). |
offset, limit | Integer | No | Pagination (offset 0 to 100000, limit 1 to 500, default 50). |
search contacts
Primary name: searchContacts · Synonym: search contacts
Searches eligible contacts by optional free text combined with any structured filters from list contacts using AND. Merges accessible linked cards by default.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | Text | No | Normalized free-text search terms (AND/prefix matching). |
includeAllCards | Boolean | No | Return one physical record per matching card instead of merged linked sets. Default: false. |
| Structured filters | Various | No | Supports the same addressBookIDs, smartFilterID, tagsAny, tagsAll, tagsExactly, tagScope, company, email, phone, phoneCountry, hasFields, lacksFields, birthdayStart, birthdayEnd, createdSince, modifiedSince, sort, descending, includePrivate, timeZone, offset, and limit parameters as list contacts. |
get contact
Primary name: getContact · Synonym: get contact
Fetches the accessible merged contact anchored by a physical contactID (or "me" for your unambiguous Me card).
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Physical card ID (bcc1.…) or "me". |
includeAllCards | Boolean | No | Also return physicalCards listing every accessible physical card in the linked set. Default: false. |
includePrivate | Boolean | No | Include My Notes and My Tags. Default: false. |
selected contacts
Primary name: selectedContacts · Synonym: selected contacts
Reads the contacts currently selected in the main BusyContacts window without opening or activating a window.
| Parameter | Type | Required | Description |
|---|---|---|---|
includeAllCards | Boolean | No | Expand selection to physical card records. Default: false. |
includePrivate | Boolean | No | Include My Notes and My Tags. Default: false. |
offset, limit | Integer | No | Pagination (limit up to 500). |
list upcoming dates
Primary name: listUpcomingDates · Synonym: list upcoming dates
Lists recurring birthdays, anniversaries, and custom dates (excluding death dates) occurring in a Gregorian day range.
| Parameter | Type | Required | Description |
|---|---|---|---|
start, end | Text | No | Gregorian YYYY-MM-DD window (start inclusive, end exclusive, 1 to 366 days; defaults to 30 days from today). |
kinds | List of Text | No | Any subset of "birthday", "anniversary", and "other". |
addressBookIDs | List of Text | No | Restrict to specific address books. |
timeZone | Text | No | IANA time zone for computing today and day boundaries. |
offset, limit | Integer | No | Pagination (limit up to 500). |
query activity
Primary name: queryActivity · Synonym: query activity
Returns Apple Mail and BusyCal calendar activity metadata for a contact along with per-source availability (mailkit, spotlight, busycal). Message bodies are never returned and BusyCal is never launched automatically. Requires Share contact activity with automation in BusyContacts > Settings > Integrations.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Physical card ID (bcc1.…) anchoring the accessible linked contact. |
kinds | List of Text | No | "mail", "calendar", or both. |
start, end | Date or Text | No | Range bounds (end exclusive, up to 366 days). Accepts AppleScript date values or zoned ISO 8601 text. |
limit | Integer | No | Maximum merged activity items (1 to 500). |
compare address books
Primary name: compareAddressBooks · Synonym: compare address books
Returns physical cards in sourceAddressBookID that have no matching card in targetAddressBookID, without editing either address book.
| Parameter | Type | Required | Description |
|---|---|---|---|
sourceAddressBookID | Text | Yes | Source address book ID (bcb1.…). |
targetAddressBookID | Text | Yes | Distinct target address book ID (bcb1.…). |
matchBy | Text | No | "linked_or_email" (default) or "linked". |
offset, limit | Integer | No | Pagination for unmatched source cards. |
parse contact text
Primary name: parseContactText · Synonym: parse contact text
Previews how BusyContacts' Quick Entry parser interprets free text (up to 64 KiB UTF-8) and reports any provider warnings without saving a contact.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | Text | Yes | Non-empty Quick Entry text (up to 64 KiB UTF-8). |
addressBookID | Text | No | Optional destination book ID used to evaluate provider label/slot warnings. |
Creating and Editing
create contact
Primary name: createContact · Synonym: create contact
Creates one person or company card in an explicit writable address book. The contact record must supply at least a name, company, field, or photo (notes and tags alone are rejected).
| Parameter | Type | Required | Description |
|---|---|---|---|
addressBookID | Text | Yes | Explicit writable address book ID (bcb1.…). |
contact | Record | Yes | User-labeled record supporting firstName, middleName, lastName, prefix, suffix, phoneticFirstName, phoneticMiddleName, phoneticLastName, maidenName, nickname, company, department, office, jobTitle, notes, privateNotes, birthday (record with year, month, and day), photoPath (absolute path starting with /), contactType ("person" or "company"), nameOrder ("default", "first_last", or "last_first"), tags, privateTags, and fields. |
create contact from text
Primary name: createContactFromText · Synonym: create contact from text
Parses Quick Entry text (up to 64 KiB UTF-8) and saves a new contact in an explicit address book, a unique book hint in the text (such as /Work), or your eligible default address book.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | Text | Yes | Non-empty Quick Entry text (up to 64 KiB UTF-8). |
addressBookID | Text | No | Explicit writable destination address book (always wins over text hints). |
update contact
Primary name: updateContact · Synonym: update contact
Patches scalar properties on one physical card. Omitted keys stay unchanged; missing value clears nullable scalars (and |photoPath|:missing value clears the current primary image).
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Exact physical card ID (bcc1.…). |
changes | Record | Yes | Non-empty user-labeled record with scalar keys to update or clear. |
update contacts
Primary name: updateContacts · Synonym: update contacts
Patches 1 to 100 distinct physical cards in a single atomic batch. Any validation error rejects the whole batch with no changes saved.
| Parameter | Type | Required | Description |
|---|---|---|---|
updates | List of Records | Yes | List of 1 to 100 user-labeled records, each containing contactID ("bcc1.…") and changes (a scalar patch record). Duplicate card IDs are rejected. |
add contact field
Primary name: addContactField · Synonym: add contact field
Adds one typed field row to a physical card and returns the created field record (including its |id|, which starts with bcf1.).
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Exact physical card ID (bcc1.…). |
field | Record | Yes | User-labeled record with kind ("phone", "email", "url", "address", "date", "related_name", "social_profile", "instant_message", or "custom"), value (text or structured record), and optional label (required for "custom"), labelType, and preference (0 to 100). |
update contact field
Primary name: updateContactField · Synonym: update contact field
Patches one exact field row, preserving omitted structured components, kind, sort order, and row identity. Structured components (address, social_profile, instant_message) accept missing value to clear individual parts.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Physical parent card ID (bcc1.…). |
fieldID | Text | Yes | Exact field row ID (bcf1.…). |
changes | Record | Yes | User-labeled record with at least one of value, label, labelType, or preference. |
remove contact field
Primary name: removeContactField · Synonym: remove contact field
Removes one exact field row. Returns fieldNotFound if the row is missing or stale.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Physical parent card ID (bcc1.…). |
fieldID | Text | Yes | Exact field row ID (bcf1.…). |
append note
Primary name: appendNote · Synonym: append note
Appends up to 1 MiB UTF-8 of plain text to a card's synced Notes or private My Notes.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Exact physical card ID (bcc1.…). |
text | Text | Yes | Non-empty plain text to append (up to 1 MiB UTF-8). |
dated | Boolean | No | Prepend a date header. Default: false. |
private | Boolean | No | Append to private My Notes instead of synced Notes. Default: false. |
add tags
Primary name: addTags · Synonym: add tags
Adds case-sensitive tags to 1 to 100 physical cards.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | 1 to 100 physical card IDs. |
tags | List of Text | Yes | Non-empty tag names to add. |
scope | Text | No | "global" (default, synced Tags), "local" (private My Tags), or "best" (uses synced Tags on writable cards and My Tags on read-only cards). |
remove tags
Primary name: removeTags · Synonym: remove tags
Removes exact tags from 1 to 100 physical cards using the same scope options as add tags.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | 1 to 100 physical card IDs. |
tags | List of Text | Yes | Exact tag names to remove. |
scope | Text | No | "global" (default), "local", or "best". |
duplicate contact
Primary name: duplicateContact · Synonym: duplicate contact
Duplicates one physical card into its current address book or another writable address book and returns the new card record.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Exact physical card ID (bcc1.…). |
addressBookID | Text | No | Optional destination writable address book (bcb1.…). |
Organizing, Linking, and Deleting
move contacts
Primary name: moveContacts · Synonym: move contacts
Moves 1 to 100 physical cards to another writable address book and returns the destination cards along with idTransitions (oldID, newID, reason:"move").
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | 1 to 100 physical card IDs. |
addressBookID | Text | Yes | Writable destination address book ID (bcb1.…). |
link contacts
Primary name: linkContacts · Synonym: link contacts
Links 2 to 100 distinct physical cards (and their eligible peers) without merging field values. Rejects the request if an existing linked peer is excluded.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | 2 to 100 distinct physical card IDs. |
unlink contacts
Primary name: unlinkContacts · Synonym: unlink contacts
Removes local link relationships for the supplied physical cards.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | Physical card IDs to unlink. |
includeLinkedCards | Boolean | No | Detach every member of each selected linked set. Default: false. |
merge contacts
Primary name: mergeContacts · Synonym: merge contacts
Merges the supplied physical cards and returns survivors, retainedCardIDs, relinkedCardIDs, deletedCardIDs, and idTransitions.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | Physical contributor card IDs. |
includeLinkedCards | Boolean | No | Expand contributors to include their accessible linked sets. Default: false. |
delete contacts
Primary name: deleteContacts · Synonym: delete contacts
Deletes 1 to 100 explicit physical cards and returns deletedCount and deletedCardIDs.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Yes | 1 to 100 physical card IDs. |
includeLinkedCards | Boolean | No | Also delete accessible linked peers of the supplied cards. Default: false. |
Import, Export, and Photos
export contacts
Primary name: exportContacts · Synonym: export contacts
Exports up to 500 cards (and up to 4 MiB total) as vCard 3.0. Supply exactly one of contactIDs, addressBookID, or tag. Private notes and My Tags are always omitted.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactIDs | List of Text | Conditional | 1 to 500 physical card IDs (mutually exclusive with addressBookID and tag). |
addressBookID | Text | Conditional | Export all eligible cards in one address book. |
tag | Text | Conditional | Export eligible cards carrying one global tag. |
mergeLinked | Boolean | No | Export merged linked sets instead of separate physical cards. Default: false. |
includeNotes | Boolean | No | Include synced Notes. Default: true. |
includePhotos | Boolean | No | Include inline photos/logos within the 4 MiB vCard budget. Default: false. |
outputFile | Text | No | Literal absolute POSIX path starting with / (no ~ expansion). Omit to receive vCard text in the text field (|text|). |
overwrite | Boolean | No | Allow replacing an existing outputFile. Default: false (returns fileExists if the file already exists). |
import contacts
Primary name: importContacts · Synonym: import contacts
Imports UTF-8 vCard data (up to 500 cards and 4 MiB, including affected cleanup cards) into an explicit writable address book and updates the local Last Import tag. Supply exactly one of vcardText or inputFile.
| Parameter | Type | Required | Description |
|---|---|---|---|
addressBookID | Text | Yes | Explicit writable destination address book ID (bcb1.…). |
vcardText | Text | Conditional | Inline UTF-8 vCard text. |
inputFile | Text | Conditional | Literal absolute POSIX path starting with / to a .vcf file. |
get contact photo
Primary name: getContactPhoto · Synonym: get contact photo
Reads a contact's primary photo or company logo as lossless PNG (proportionally scaled to at most 4 MiB and 40 megapixels without altering stored attachments).
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Physical card ID (bcc1.…). |
outputFile | Text | No | Literal absolute POSIX path starting with /. Omit to receive dataBase64 inline. |
overwrite | Boolean | No | Allow replacing an existing outputFile. Default: false. |
set contact photo
Primary name: setContactPhoto · Synonym: set contact photo
Sets a contact's primary image from an absolute file path (scaled proportionally to PNG up to 4 MiB and 40 megapixels without modifying the source file), or clears the current primary image when given missing value.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Physical card ID (bcc1.…). |
inputFile | Text or missing value | Yes | Literal absolute POSIX path starting with /, or missing value to clear the primary photo/logo. |
Navigation
open contact
Primary name: openContact · Synonym: open contact
Reveals a physical contact card in the main BusyContacts window or in a floating Info window. May open and activate BusyContacts.
| Parameter | Type | Required | Description |
|---|---|---|---|
contactID | Text | Yes | Exact physical card ID (bcc1.…). |
floating | Boolean | No | Open the card in a separate floating Info window. Default: false. |
show smart filter
Primary name: showSmartFilter · Synonym: show smart filter
Activates a saved Smart Filter in the main BusyContacts window. May open and activate BusyContacts.
| Parameter | Type | Required | Description |
|---|---|---|---|
smartFilterID | Text | Yes | Saved Smart Filter ID (bcs1.…). |
Examples
List writable address books and find a book ID
tell application "BusyContacts"
set booksResult to list address books given writableOnly:true
set outputLines to {}
repeat with bookItem in (|items| of booksResult)
set end of outputLines to (|title| of bookItem) & " (" & (|id| of bookItem) & ")"
end repeat
return outputLines
end tell
Search contacts by tag, missing field, and recent date
tell application "BusyContacts"
set oneWeekAgo to (current date) - (7 * days)
set found to search contacts given tagsAll:{"Client"}, lacksFields:{"phone"}, modifiedSince:oneWeekAgo, limit:25
set names to {}
repeat with person in (|items| of found)
set end of names to |displayName| of person
end repeat
return names
end tell
Check upcoming birthdays and anniversaries
tell application "BusyContacts"
set upcoming to list upcoming dates given start:"2026-12-01", end:"2027-01-01", kinds:{"birthday", "anniversary"}, timeZone:"UTC"
set summary to {}
repeat with entry in (|items| of upcoming)
set personName to |displayName| of (|contact| of entry)
set onDay to |occursOn| of entry
set end of summary to onDay & " - " & personName
end repeat
return summary
end tell
Preview Quick Entry text and create a contact
tell application "BusyContacts"
set signatureText to "Grace Hopper, Rear Admiral, grace@example.com, +1 202-555-0199"
set preview to parse contact text given text:signatureText
-- Inspect preview before saving, then create in your default or explicit book:
set created to create contact from text given text:signatureText
return |id| of (|contact| of created)
end tell
Create a structured contact, edit fields, append a note, and tag
tell application "BusyContacts"
-- Pick the first writable address book
set books to |items| of (list address books given writableOnly:true)
set bookID to |id| of item 1 of books
-- Create a contact with a yearless birthday
set created to create contact given addressBookID:bookID, contact:{|firstName|:"Ada", |lastName|:"Lovelace", |company|:"Analytical Engines", |jobTitle|:"Chief Engineer", |birthday|:{|year|:missing value, |month|:12, |day|:10}}
set cardID to |id| of (|contact| of created)
-- Add an email field and capture its field ID
set added to add contact field given contactID:cardID, field:{|kind|:"email", |label|:"work", |value|:"ada@example.com"}
set emailFieldID to |id| of (|field| of added)
-- Update that exact email field without changing its label or order
update contact field given contactID:cardID, fieldID:emailFieldID, changes:{|value|:"ada.lovelace@example.com"}
-- Clear a scalar property using missing value (omitted fields stay intact)
update contact given contactID:cardID, changes:{|jobTitle|:"Principal Engineer", |notes|:missing value}
-- Append a dated note and add a tag
append note given contactID:cardID, text:"Met at the engineering summit.", dated:true
add tags given contactIDs:{cardID}, tags:{"Conference"}
return cardID
end tell
Batch-update multiple contacts atomically
tell application "BusyContacts"
set results to update contacts given updates:{{|contactID|:"bcc1.REPLACE_1", |changes|:{|company|:"Analytical Engines"}}, {|contactID|:"bcc1.REPLACE_2", |changes|:{|company|:"Analytical Engines", |department|:"Research"}}}
return |cardResults| of results
end tell
Export vCards to a file and set or clear a photo
tell application "BusyContacts"
set selected to |items| of (selected contacts given includeAllCards:true)
if (count of selected) is 0 then return "No contacts selected."
set cardID to |id| of item 1 of selected
set exportPath to POSIX path of (path to desktop) & "contact-export.vcf"
export contacts given contactIDs:{cardID}, includeNotes:true, outputFile:exportPath, overwrite:true
-- Set a photo from an absolute path, or clear it with missing value:
-- set contact photo given contactID:cardID, inputFile:"/Users/yourname/Pictures/ada.png"
-- set contact photo given contactID:cardID, inputFile:missing value
return exportPath
end tell
Compare two address books and track moved card IDs
tell application "BusyContacts"
set books to |items| of (list address books)
set sourceBookID to |id| of item 1 of books
set targetBookID to |id| of item 2 of books
set diffResult to compare address books given sourceAddressBookID:sourceBookID, targetAddressBookID:targetBookID, matchBy:"linked_or_email"
set unmatchedIDs to {}
repeat with card in (|items| of diffResult)
set end of unmatchedIDs to |id| of card
end repeat
-- Example: move the first unmatched card and read its new ID from idTransitions
if (count of unmatchedIDs) > 0 then
set moved to move contacts given contactIDs:{item 1 of unmatchedIDs}, addressBookID:targetBookID
return |idTransitions| of moved
end if
return {}
end tell
Review contact activity metadata and open a card
tell application "BusyContacts"
set matches to |items| of (search contacts given text:"Ada Lovelace", limit:1)
if (count of matches) is 0 then return "Not found."
set cardID to |id| of item 1 of matches
set activity to query activity given contactID:cardID, kinds:{"mail", "calendar"}, limit:10
open contact given contactID:cardID, floating:true
return |items| of activity
end tell
Error Handling
Every BusyContacts service error returns AppleScript error number -10000 with a message prefixed by its stable error code ("<code>: <message>"). macOS Apple Events permission errors (such as -1743 when Automation access is denied in System Settings) keep their system error numbers.
Common error codes include:
invalidArguments: Unknown record key, unpiped AppleScript property keyword, invalid date format, or out-of-range pagination/batch count.notFound/staleIdentifier: The contact, address book, or Smart Filter ID no longer exists (refetch after moves, merges, or sync refreshes).fieldNotFound: The exactfieldIDwas removed or rebuilt during a sync refresh; fetch the contact again withget contact.readOnlyAddressBook/readOnlyContact: Attempted a global write on a read-only address book or card.privateDataRequired: Requested local/private tags or a Smart Filter referencing private fields withoutincludePrivate:true.providerLimit: Violated an Exchange EWS or Microsoft Graph field/slot limit.fileExists/fileAccessDenied: Destination file exists withoutoverwrite:true, or the path is not an accessible literal absolute path.photoNotFound/invalidImage: Contact has no primary image, or the supplied file is not a valid image.payloadTooLarge: Request, vCard, note, Quick Entry text, or affected card count exceeded its limit.
Wrap commands in a try block to handle failures cleanly:
tell application "BusyContacts"
try
set resultRecord to list tags given scope:"local"
on error errMsg number errNum
if errNum is -10000 and errMsg starts with "privateDataRequired:" then
set resultRecord to list tags given scope:"local", includePrivate:true
else
error errMsg number errNum
end if
end try
end tell
Related Automation Guides
- Siri and Shortcuts: Build visual workflows in the Shortcuts app and run App Shortcuts with Siri.
- AI & MCP Server: Connect Claude, Codex, ChatGPT, Gemini, or other MCP assistants to BusyContacts.
- URL Handler: Open or create contacts via
busycontacts://links and launcher integrations like Alfred and LaunchBar.