Jump to content

Add contact Workflow


Recommended Posts

  • 2 years later...
On 11/14/2020 at 4:17 PM, Daniele said:

Hello,

 

is there a workflow to quick add a new contact directly using Alfred?

 

Thanks

 

See if this is helpful. I just created workflow to add new contact from selected phone text and using universal text action.

 

1. Two blocks in workflow as below

 

image.png.fd658ec86a4faf41287251fba6f1e1ae.png

 

2. Applescript code used

on run argv
  set selectedText to item 1 of argv
-- Get the selected text (assuming it contains a phone number)

-- Prompt for first name, last name, and company
display dialog "Please enter Contact’s First Name:" default answer "First Name"
set ClientName to text returned of result

display dialog "Please Enter Contact’s Last Name:" default answer "Last Name"
set LastClientName to text returned of result

display dialog "Please enter Contact’s Company:" default answer "Company Name"
set companyName to text returned of result

-- Create a new contact with the provided information
tell application "Contacts"
    set thePerson to make new person with properties {first name:ClientName, last name:LastClientName}
    tell thePerson
        set organization to companyName
    end tell
    
    -- Add the selected text (phone number) as a phone number for the contact
    make new phone at end of phones of thePerson with properties {label:"mobile", value:selectedText}
    
    -- Save the changes
    save
end tell

end run

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...