set fileRef to choose file name with prompt "出力フォルダの選択" default name "contact.vcf"
open for access fileRef with write permission

tell application "Outlook Express"
activate
set contact_list to ID of contacts
repeat with contact_id in contact_list
write "BEGIN:VCARD" & return to fileRef
write "VERSION:3.0" & return to fileRef
set fn to first name of contact id contact_id
set ln to last name of contact id contact_id
set name_field to "N:" & ln & ";" & fn & ";;;" & return
write name_field to fileRef
set full_name to "FN:" & ln & " " & fn & return
write full_name to fileRef
set ORG to "ORG:" & company of contact id contact_id & ";" & return
write ORG to fileRef
set title_field to "TITLE:" & title of contact id contact_id & return
write title_field to fileRef
set emails to email addresses of contact id contact_id
repeat with email in emails
set email_field to "EMAIL;type=HOME:" & email & return
write email_field to fileRef
end repeat
set hpn to home phone number of contact id contact_id
if hpn is not "" then
set hpn_field to "TEL;type=HOME:" & hpn & return
write hpn_field to fileRef
end if
set bpn to business phone number of contact id contact_id
if bpn is not "" then
set bpn_field to "TEL;type=WORK:" & bpn & return
write bpn_field to fileRef
end if
set cpn to cell phone number of contact id contact_id
if cpn is not "" then
set cpn_field to "TEL;type=CELL:" & cpn & return
write cpn_field to fileRef
end if
set country_field to zip of home address of contact id contact_id
set zip_field to country of home address of contact id contact_id
set state_field to city of home address of contact id contact_id
set city_field to state of home address of contact id contact_id
set streetaddress2_field to street address 2 of home address of contact id contact_id
set streetaddress1_field to street address of home address of contact id contact_id
set HA to "ADR;type=HOME;type=pref:;;" & streetaddress1_field & ";" & city_field & ";" & state_field & ";" & zip_field & ";" & country_field & return
write HA to fileRef
set country_field to zip of business address of contact id contact_id
set zip_field to country of business address of contact id contact_id
set state_field to city of business address of contact id contact_id
set city_field to state of business address of contact id contact_id
set streetaddress2_field to street address 2 of business address of contact id contact_id
set streetaddress1_field to street address of business address of contact id contact_id
set BA to "ADR;type=WORK:;;;" & streetaddress1_field & ";" & city_field & ";" & state_field & ";" & zip_field & ";" & country_field & return
if streetaddress1_field is not "" then
write BA to fileRef
end if
set hwp to home web page of contact id contact_id
if hwp is not "" then
set HomeWeb to "URL:" & hwp & return
write HomeWeb to fileRef
else
set bwp to business web page of contact id contact_id
if bwp is not "" then
set BusinessWeb to "URL:" & hwp & return
write BusinessWeb to fileRef
end if
end if
write "END:VCARD" & return to fileRef
end repeat
end tell

close access fileRef