Home Bunny Posted July 28, 2008 Posted July 28, 2008 Hi, What does this script do? If you have copied all your NOKIA Telephone Contacts with bluetooth to your Computers HardDrive, you wil have 200+ seperate vCard Files. How can you import these into Outlook (or another mail program)? One By one? This script will merge all these small files into one CSV file. This is a script without GUI! configuration is done into the the 3 first lines. expandcollapse popup$SearchFolder = "C:\Temp\Nokia\Contacts\" $SearchExt = "vcf" $SaveToFile = "C:\Temp\Nokia\Contacts\Export.csv" Dim $H_Begin, $H_Version, $H_Name, $H_TelWork, $H_FaxWork, $H_End $search = FileFindFirstFile($SearchFolder & "*." & $SearchExt) ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf $SaveFile = FileOpen( $SaveToFile, 2 ) $WriteLine = "BEGIN" & "," & "VERSION" & "," & "NAME" & "," & "WORK_TEL" & "," & "WORK_FAX" & "," & "END" FileWriteLine($SaveFile,$WriteLine) While 1 $file = FileFindNextFile($search) If @error Then ExitLoop ;~ MsgBox(4096, "File:", $file) $VCARD_File = FileOpen($SearchFolder & $file, 0) ; Check if file opened for reading OK If $VCARD_File = -1 Then MsgBox(0, "Error", "Unable to open file." & $VCARD_File) Exit EndIf $H_Begin = "" $H_Version = "" $H_Name = "" $H_TelWork = "" $H_FaxWork = "" $H_End = "" ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($VCARD_File) If @error = -1 Then ExitLoop $Header = StringTrimRight($line, StringLen($line) - StringInStr($line,":") + 1 ) $result = StringTrimLeft($line,StringLen($Header) + 1 ) Select Case $header = "BEGIN" $H_Begin = $result Case $header = "VERSION" $H_Version = $result Case $header = "N" $H_Name = StringReplace( $result,";", "") Case $header = "TEL;VOICE" $H_TelWork = $result Case $header = "TEL;FAX" $H_FaxWork = $result Case $header = "END" $H_End = $result EndSelect Wend $WriteLine = $H_Begin & "," & $H_Version & "," & $H_Name & "," & $H_TelWork & "," & $H_FaxWork & "," & $H_End FileWriteLine($SaveFile,$WriteLine) FileClose($VCARD_File) WEnd ; Close the search handle FileClose ( $search ) FileClose ( $SaveFile )
microera Posted August 28, 2009 Posted August 28, 2009 (edited) Nice!! I have problem to create form one VCF file (whic have many single VCF cards): ------------------------------------------------------------- all_vcf_in_one_file.vcf BEGIN:VCARD VERSION:2.1 N:;?agar ?tefka;;; TEL:041802581 NOTE: END:VCARD BEGIN:VCARD VERSION:2.1 N:;?agar Bojan;;; TEL;CELL:031820666 NOTE: END:VCARD BEGIN:VCARD VERSION:2.1 N:;?agar Erik;;; TEL;CELL:031613595 NOTE: END:VCARD ------------------------------------------------------------------------------------- when I try to upload with nokia pc suite only one vcf card is instered to nokia! anybody make batch file wich create more vcf single files form one vcf file (wich have many visit cards(VCF) like example above? So: I need extract from one vcf file to more vcf files. Each file begin with BEGIN:VCARD and end with: END:VCARD In above example ... 3 files! Edited August 28, 2009 by microera
microera Posted August 30, 2009 Posted August 30, 2009 this example extract vCards from one .vcf file (if exists many vcards in it): 1st: copy .vcf file to input.vcf extracting vCards are numbured from 1 to _.vcf expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.1.1 (beta) Author: myName / modified: microera Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $inputfile ="input.vcf" Dim $H_Begin, $H_Version, $H_Name, $H_TelWork, $H_FaxWork, $H_End ;~ MsgBox(4096, "File:", $file) $VCARD_File = FileOpen($inputfile, 0) ; Check if file opened for reading OK If $VCARD_File = -1 Then MsgBox(0, "Error", "Unable to open file." & $VCARD_File) Exit EndIf $H_Begin = "" $H_End = "" $counterV=0 ;vCard counter $New_vCard=0 ;flag for begining of vCard ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($VCARD_File) If @error = -1 Then ExitLoop $Header = StringTrimRight($line, StringLen($line) - StringInStr($line,":") + 1 ) $result = StringTrimLeft($line,StringLen($Header) + 1 ) ;MsgBox(4096, "Header=", $Header ) ;MsgBox(4096, "result=", $result ) Select Case $header = "BEGIN" $H_Begin = $result Case $header = "END" $H_End = $result EndSelect if $H_Begin="VCARD" then if $New_vCard=0 then $counterV=$counterV+1 $SaveFile = FileOpen( $counterV & ".vcf", 2 ) EndIf ;FileWriteLine($SaveFile,$line) $New_vCard=1 ;flag for begining vCard EndIf if $New_vCard=1 then FileWriteLine($SaveFile,$line) ;if new vCARD then writeln(copy) if $H_End="VCARD" then ;FileWriteLine($SaveFile,$line) ;last writelen(copy) FileClose ( $SaveFile ) $New_vCard=0 $H_Begin = "" $H_End = "" EndIf Wend FileClose($VCARD_File)
Moderators JLogan3o13 Posted June 25, 2018 Moderators Posted June 25, 2018 @ElijahWright did you not notice this post is over 9 years old? And the OP has not been on the forum since 2010? Please do not resurrect old threads, especially to peddle a non-AutoIt solution. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Moderators Melba23 Posted June 25, 2018 Moderators Posted June 25, 2018 ElijahWright, And as in addition you only registered to advertise a payware solution, you can vanish. Bye! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now