This should be easy but I have tried and tried and I have looked everywhere for clues! Please help!!
-- CREATING THE NEW MEMBER
repeat
set theResult to display dialog "CREATE NEW MEMBER
Please enter your first name
" default answer ""
set theFirstName to text returned of theResult
set theClipboard to text returned of theResult
if (theFirstName does not start with "Example:") then
exit repeat
end if
end repeat
repeat
set theResult to display dialog "
Please enter your surname
" default answer ""
set theLastName to text returned of theResult
set theClipboard to text returned of theResult
if (theLastName does not start with "Example:") then
exit repeat
end if
end repeat
tell application "Address Book"
set the_ID to (make new person with properties {first name:theFirstName, last name:theLastName, phone:"+07966284765"})'s id
set the mobilePhone to ("+447966284765")
save addressbook
end tell
open location "addressbook://" & the_ID
I am not using “Mail” application or the address book in “Entourage”.
The address book is the standard Address Book in osX Applications.
I just want the phone number and home address to be inserted in the new card which I have been able to create. Do I have to somehow activate the EDIT mode of the card in Address Book in order to insert this info.?
Some people have tried to use a repeat tab comand, click and paste to enter a value but none of the examples I researched functioned at all.
Sorry - you didn’t read it through - it’s doing with email addresses what you want to do with phones. I’ve extracted it here:
set theName to text returned of (display dialog "Enter a full name" default answer "")
tell application "Address Book"
-- Make new record. The name may need some work (for names with three words etc.)
set newPerson to make new person with properties {first name:(word 1 of theName), last name:(word -1 of theName)}
-- Add the phone number.
tell newPerson to make new phone at end of phones with properties {label:"Home", value:"+447966284765"}
-- Update Address Book.
save addressbook
end tell
set {tName, tPhone} to paragraphs of text returned of (display dialog "Enter a full name, a return, and a Phone Number then 'Enter'" default answer "Name" & return & "Phone")
set tLabel to (choose from list {"Home", "Work", "Mobile", "Cell", "Other"} with prompt "Choose one") as Unicode text
set tNote to text returned of (display dialog "Do you want to add a note?" default answer "Note Here")
if tNote is "Note Here" or tNote is "" then set tNote to "No Note"
tell application "Address Book"
-- Make new record. The name may need some work (for names with three words etc.)
set newPerson to make new person with properties {first name:(word 1 of tName), last name:(word -1 of tName), note:tNote as Unicode text}
-- Add the phone number.
tell newPerson to make new phone at end of phones with properties {label:tLabel, value:tPhone}
-- Update Address Book.
save addressbook
end tell