#!/usr/bin/perl # Tilman Reissfelder 2004-10-07 # in Address Book: # - set vCard preferences to: V2.1 UTF-8 # - highlight all contacts, right click and select 'Export vCard...' # - run resulting file through this converter # - upload output file to T-Mobile # - done # known problems: # There seems to be a problem with home phones: the importer does not read them, so I added # the first home phone as 'Main Phone' as well. print "First Name Last Name Title Suffix Nickname Company Job Title Dept Work Street Address Work City Work State Work Zip Work Country/Region Work URL Home Street Address Home City Home State Home Zip Home Country/Region Home URL Home Phone 1 Home Phone 2 Home Fax Work Phone 1 Work Phone 2 Work Fax Pager Mobile Phone Main Phone Assistant Phone Custom Phone 1 Custom Phone 2 Custom Phone 3 Custom Phone 4 Email Address 1 Email Address 2 Email Address 3 Email Address 4 Email Address 5 Email Address 6 Email Address 7 Email Address 8 Email Address 9 Email Address 10 Email Address 11 Email Address 12 Email Address 13 Custom 1 Custom 2 Custom 3 Custom 4 Custom 5 Custom 6 Custom 7 Custom 8 Custom date 1 Custom date 2 Spouse Birthday Anniversary Notes Age Astrology sign Bloodtype Furigana Company Name Furigana First Name Furigana Last Name Furigana Spouse Name Interests\r"; while() { chop(); chop(); s/\\,/,/g; if (/^BEGIN:VCARD$/) { @data = (); } elsif (/^END:VCARD$/) { if ($#data > 0) { for ($i = 0; $i < 69; $i++) { print "\t" if ($i > 0); print $data[$i]; } print "\r"; } } elsif (/^N:([^;]*);([^;]*);([^;]*);([^;]*);(.*)$/) { $data[0] = $2; $data[1] = $1; } elsif (/^TEL([^:]*):(.+)$/) { my $types = $1; my $phone = $2; if ($types =~ /WORK/) { if ($types =~ /FAX/) { $data[25] = $phone; } elsif ($data[23] eq '') { $data[23] = $phone; } elsif ($data[24] eq '') { $data[24] = $phone; } } elsif ($types =~ /FAX/) { $data[22] = $phone; } elsif ($types =~ /HOME/) { if ($data[20] eq '') { $data[20] = $phone; $data[28] = $phone; } elsif ($data[21] eq '') { $data[21] = $phone; } } elsif ($types =~ /CELL/) { $data[27] = $phone } elsif ($data[30] eq '') { $data[30] = $phone; } elsif ($data[31] eq '') { $data[31] = $phone; } elsif ($data[32] eq '') { $data[32] = $phone; } elsif ($data[33] eq '') { $data[33] = $phone; } } elsif (/^EMAIL[^:]*:(.+)$/) { my $mail = $1; my $i = 34; $i++ while (($i <= 45) && ($data[$i] ne '')); $data[$i] = $mail if ($i <= 45); } elsif (/^ORG[^:]*:([^;]*);(.*)$/) { $data[5] = $1; } elsif (/^TITLE[^:]*:(.*)$/) { $data[2] = $1; } }