• 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: Address Book - Export Group
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Address Book - Export Group


  • Subject: Re: Address Book - Export Group
  • From: Michelle Steiner <email@hidden>
  • Date: Tue, 4 Jan 2005 18:13:37 -0700

On Jan 4, 2005, at 5:07 PM, John M wrote:

By the way, on my system this works (I can re-import the vcard into the Addressbook), but the file is opened by TextEdit by default. How can you change this? I tried:
set default application of target_file to ((path to applications folder) as text) & "Address Book.app:"
but this doesn't seem to be allowed.

You have to create the file with the Finder, as shown in the following modified script. I also put in code for selecting the file's location and the group, so they're not hard coded. And while I was at it, I took the code for creating and saving the file out of the "tell application" wrapper, and made it into a handler.

-- Michelle

set to (choose folder)
tell application "Address Book"
set to (choose from list (get (name of groups)))
if is not false then
set to item of
set to count of people in group
set to ""
repeat with from to
set to & ¬
(
vcard of person of group ) as text
end repeat
my , , )
end if
end tell

on , , )
try
set to & ""
set to ( as text) &
tell application "" to make new file at ¬
with properties {name & "", creator type"}
set the to ¬
open for access file with write permission
set eof of the to
write to the starting at eof
close access the
on error number
return
end try
end makeExportFile

--
Never play strip Tarot.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Address Book - Export Group (From: John M <email@hidden>)

  • Prev by Date: Re: Converting binary to decimal
  • Next by Date: Re: Converting binary to decimal
  • Previous by thread: Re: Address Book - Export Group
  • Next by thread: More fun with FileMaker 7...
  • Index(es):
    • Date
    • Thread