• 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
Re: How does one save a vcard?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does one save a vcard?


  • Subject: Re: How does one save a vcard?
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 30 Mar 2007 09:27:41 -0700
  • Thread-topic: How does one save a vcard?

On 3/29/07 4:11 PM,
"applescript-users-bounces+berkowit=email@hidden"
<applescript-users-bounces+berkowit=email@hidden> wrote:

> I've tried everything I can think of, but none of it works.  It
> either creates an error or fails silently.
>
> Here is one example:
>
> tell application "Address Book"
> set daName to name of person 1
> tell application "Finder"
> make new file with properties {name:daName & ".vcf"} at folder "Dora"
> set dest to the result as alias
> end tell
> set foo to vcard of person 1
> save foo in dest
> end tell
>
> I've tried it without creating the file with the Finder.
>
> -- Michelle


tell application "Address Book"
    set daName to name of person 1
    set vcardData to vcard of person 1
end tell

set dest to (path to home folder as Unicode text) & daName & ".vcf"
set foo to open for access file dest with write permission
set eof foo to 0
write vcardData to num
close access foo


In my case (perhaps because my own default app for .vcf is Entourage, not
Address Book, but I think it will happen in all cases since the default file
type when making a file via 'open for access' is TEXT) - the resulting .vcf
file appears with a text file icon, not an Address Book icon. The file can
be opened in Address Book regardless, and is easily fixable by adding this
to the script:


tell application "Finder"
    set file type of file dest to missing value
    set creator type of file dest to missing value
end tell


When its creator and file types are missing value, the icon defaults to
Address Book's vcard icon.

--
Paul Berkowitz


 _______________________________________________
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

  • Follow-Ups:
    • Re: How does one save a vcard?
      • From: Paul Berkowitz <email@hidden>
References: 
 >How does one save a vcard? (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Selecting existing mail account
  • Next by Date: (no subject)
  • Previous by thread: How does one save a vcard?
  • Next by thread: Re: How does one save a vcard?
  • Index(es):
    • Date
    • Thread