Search

Extract Kontak Pada .NBU Ke .CSV

Beberapa hari lalu touchscreen hp rusak, jadi sama sekali ga bisa dipake, blm sempat salin kontak ke sim. Akhirnya dapat pinjaman hp jadul. males mesti ngetik kontak satu-satu, mau pinjem punya temen buat nyalin kontak ke sim sayangnya ga ada yang pake nokia. beruntung sebelumnya sudah membuat backup seisi hp, jadi kepikiran mindahin itu kontak yang ada di nbu lewat modem (huawei, app : mobile partner).


udah coba NbuExplorer, abc converter, & Noki tapi hasilnya ga sesuai keinginan. Noki sebenarnya punya semua yang saya butuhkan, tapi dalam trial dibatasi file yang diexport sampai 50.

Akhirnya ketemu http://mginternet.wordpress.com/2011/11/09/nbu-to-csv-2-1-update-version/


Singkatnya,
buat sebuah teks file (:buka notepad), copy lalu paste teks dibawah ini ke notepad.

'*****************************************************************
''*****               Convert NBU file to CSV             ********
''*****                09 October    2012                 ********
''*****              http://MGinternet.co.uk              ********
''*****                                                   ********
'*****************************************************************

Dim Fso, debugmode, ContactName, lineSplit, MobileNo, HomeNo,WorkNo
dim MobileNoX,MobileNoX2, HomeNoX,WorkNoX, org, Title
debugmode=0
Set Fso = WScript.CreateObject("Scripting.FileSystemObject")
'Create user
set Userlist = fso.openTextFile("file.nbu",1)
Set Report = fso.OpenTextFile("Output.csv",8,1)
report.writeline("Name,Mobile Phone,Home Phone,Business Phone,Company,Job Title,Car Phone")
    MobileNoX= ""
    WorkNoX= ""
    HomeNoX= ""
    refNoX = ""
    Org = ""
    Title = ""

do while not Userlist.AtEndOfStream

 Details = Userlist.readline
 if debugmode =1 then msgbox(details)

 if left(Details,2) = "N:" or left(Details,2) = "N;" then

   lineSplit = split(Details,":")
    ' if left(Details,2) = "N;" then lineSplit = split(Details,";")
    if ubound(lineSplit) > 0 then 
    contactname = linesplit(ubound(lineSplit))
    else
    contactname = "Unknown"
    end if
    
    ' clear out extra ; in then name
    contactname = replace(contactname,";"," ")
'    lineSplit = split(contactname,";")
'    contactname = chr(34) & trim(LineSplit(1)) &" "& trim(LineSplit(0)) & chr(34)
    if debugmode = 1 then msgbox(contactname)
end if

    If FindString((details),"CELL") Then
        if MobileNoX = "" then
                MobileNo = split(Details,":")
                MobileNoX = MobileNo(1)
            else
                MobileNo = split(Details,":")
                MobileNoX2 = MobileNo(1)
        end if

        if debugmode =  1 then msgbox(MobileNo(1))

    End If
    If FindString((details),"HOME") Then
        HomeNo = split(Details,":")
        HomeNoX = HomeNo(1)
        if debugmode =  1 then msgbox(HomeNo(1))
    End If
    If FindString((details),"WORK") Then
        WorkNo = split(Details,":")
        WorkNoX = WorkNo(1)
        if debugmode =  1 then msgbox(WorkNo(1))
    End If

    If FindString((details),"PREF") Then
        if  (FindString((details),"HOME")) = False and _
            (FindString((details),"CELL")) = False and _
            (FindString((details),"WORK")) = False Then  
        WorkNo = split(Details,":")
        WorkNoX = WorkNo(1)
        if debugmode =  1 then msgbox(contactname & " on the number " & WorkNo(1))
    End If
    end if

 if left(Details,3) = "ORG" then
     SplitLine=(split(details,":"))
     org = Replace(SplitLine(1), ";","")

 end if

  if left(Details,3) = "TIT" then
     SplitLine=(split(details,":"))
     Title = Replace(SplitLine(1), ";","")

 end if

 if left(Details,3) = "END" then
 if debugmode =  1 then msgbox("Do End Write")
    report.writeline(contactname & "," & MobileNoX & "," & HomeNoX & "," & WorkNoX &  "," & Org & "," & title & "," & MobileNoX2)
 if debugmode =  2 then msgbox(contactname & "," & MobileNoX & "," & HomeNoX & "," & WorkNoX &  "," & Org & "," & title)
    MobileNoX= ""
        MobileNoX2= ""
    WorkNoX= ""
    HomeNoX= ""
    refNoX = ""
    Org = ""
    Title = ""
End if

loop

Msgbox("Done")

Function FindString(strCheck,strFind)

    intPos = 0
    intPos = InStr(strCheck, strFind)
    FindString = intPos > 0

End Function

save, lalu rename menjadi  convert.vbs .
 letakan convert.vbs di folder yang sama dengan file backupnya (.nbu) , rename nbu menjadi file.nbu .
open convert.vbs, wait a moment & akan muncul file Output.csv .

end.

Tidak ada komentar:

Posting Komentar

Blogger Template