• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
FMPro to Contacts (AddressBook)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FMPro to Contacts (AddressBook)


  • Subject: FMPro to Contacts (AddressBook)
  • From: John Valean Baily <email@hidden>
  • Date: Wed, 06 Nov 2013 16:07:35 -0500

Hi Scripters,

I'm OK with FileMaker Pro 12, but new to AppleScript. Im using FMP 12 and Mavericks.

I'm trying to transfer contact information from my Contacts.fp12 database to the app Contacts... formerly known as AddressBook.

I got the following from a FMP developer, some of it works and some of it doesn't under varying circumstances.

For instance, a new entry in FMP does transfer to Contacts correctly if I don't have any data in the FMP portal for telephone entries. But, does NOT transfer if there is one or more numbers in the portal.

I get an error stating  " Can't get Item 5 of Main "
"Main" being the telephone type entry associated (in this case) with the tel number.
 
Also, the URL will not transfer... but the other Org and contact info does transfer.

On the way back to FMP from Contacts, the Contacts ID will not populate the AddressBookID field in Contacts.fp12 database used to test if the current entry has already been transferred.

tell application "FileMaker Pro Advanced"
activate "Contacts.fp12"
-- go to layout "Layout #1"
set first_name to cell "FirstName" of current record
set middle_name to cell "MiddleName" of current record
set last_name to cell "LastName" of current record
set org to cell "OrganizationName_LU" of current record
set dept to cell "Department" of current record
set name_suffix to cell "suffix" of current record
set mr_mrs to cell "Prefix" of current record
set notes to cell "Notes" of current record
set home_URL to cell "URL" of current record
set job_title to cell "Title" of current record
--set birth_date to cell "Notes" of current record


set the_phone_numbers to get data cell "PhoneNumbers::Number" of current record of database "Contacts.fp12"
set the_phone_labels to get data cell "PhoneNumbers::Type" of current record of database "Contacts.fp12"
set AddressHome_CT to get data cell "AddressHome_CT" of current record of database "Contacts.fp12"
set AddressWork_CT to get data cell "AddressWork_CT" of current record of database "Contacts.fp12"
set AddressOther_CT to get data cell "AddressOther_CT" of current record of database "Contacts.fp12"
end tell

tell application "Contacts"
activate
set newPerson to make new person with properties {first name:first_name, middle name:middle_name, last name:last_name, organization:org, department:dept, suffix:name_suffix, title:mr_mrs, note:notes, home page:home_URL, job title:job_title}


set the_count to count of the_phone_numbers
repeat with i from 1 to the_count
-- a_phone_number in the_phone_numbers
tell newPerson to make new phone at end of phones with properties {value:(item i of the_phone_numbers), label:(item i of the_phone_labels)}
end repeat


if AddressHome_CT ≠ "" then
tell newPerson to make new address at end of addresses with properties {street:AddressHome_CT, label:"Home"}
end if
if AddressWork_CT ≠ "" then
tell newPerson to make new address at end of addresses with properties {street:AddressWork_CT, label:"Work"}
end if
if AddressOther_CT ≠ "" then
tell newPerson to make new address at end of addresses with properties {street:AddressOther_CT, label:"Other"}
end if


save "Contacts"
set AddressBookID to id of newPerson
return result
end tell

delay 1

tell application "FileMaker Pro Advanced"
activate
set cell AddressBookID of current record to AddressBookID
end tell

Any assistance will doubtless increase my capabilities... and be much appreciated ;)
TIA.

--
Regards

John Valean (Val) Baily

FileMaker Pro Database Development;
FM Go Mobile Application Development;
FileMaker Business Alliance & FileMaker TechNet Member;
SyncDek Developers Alliance;
Member, Fujitsu Imaging Reseller Program.

http://www.electronic-type.com
Tel: (519) 823-9585
Cel: (519) 546-2902

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: iWork 2013
  • Next by Date: Re: iWork 2013
  • Previous by thread: Re: iWork 2013
  • Next by thread: RE: FMPro to Contacts (AddressBook)
  • Index(es):
    • Date
    • Thread