Convert Nokia NBU file (2.1) to CSV

Posted: June 14, 2011 in Windows Scripts

This script converts a nokia NBU type file exported for a Nokia phone, to a CSV file. Which you can import into Outlook or other program. This is the V2.1 of the file. Just copy and past the file into a text file and call it convert.vbs. Name your nbu file as file.nbu and run. ( Don’t worry too much if there is an error, just check the output.csv for all your contacts!).

—->  There is an updated version of this Script here. <—–

'*****************************************************************
''*****               Convert NBU file to CSV             ********
''*****                 12 June 2011                      ********
''*****               The Gamblor                  ********
''*****                                                   ********
'*****************************************************************

Dim Fso, debugmode, ContactName, lineSplit, MobileNo, HomeNo,WorkNo
dim MobileNoX, 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,Home,Work,Org,Title")
    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:" then

    lineSplit = split(Details,":")
    contactname = linesplit(1)
'    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
        MobileNo = split(Details,":")
        MobileNoX = MobileNo(1)
        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)
 if debugmode =  2 then msgbox(contactname & "," & MobileNoX & "," & HomeNoX & "," & WorkNoX &  "," & Org & "," & title)
    MobileNoX= ""
    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
About these ads
Comments
  1. Softray says:

    Great. Just need to modify as per our need. Good Job

  2. arpit says:

    Please create this file and upload it on rapidshare or mediafire…i am unable to do as u have said

  3. arpit says:

    It doesnt work for messages..please help

  4. mginternet says:

    No It does not work for message, Just contacts, if you open your NBU file in a text editor, it should give you a version number, like VERSION:2.1 (usually on the 3rd line down).

    What is the version number your having problems with?

  5. joe says:

    hi,
    i desperately try to download my contacts from my nokia x6 and import it to google. as i have multiple numbers per contact, the workaround with outlook doesn’t work for me as many of the numbers get lost.
    the nbu file is a 2.1 version, but when i run your programme the numbers often do not fit to the names and some names show up way more times than i have numbers for them (just showing numbers of others in the same row).
    any suggestions?

    thanks a lot
    joe

  6. mginternet says:

    I’ve never Exported an NBU file from an X6 so no idea if the format is different or not, Without seeing the NBU file I don’t know what is going wrong. I’m happy to have a look, if you want to send me the NBU file. You can e-mail it mike@mginternet.co.uk, and then I’ll update the script to cope with the changes.

  7. euvindec says:

    how the heck do i run a script? (noob question)

    thx in advance

  8. Kalpesh Thakor says:

    thanks a lot……….

  9. Santosh says:

    Thank for a nice utility. But it’s showing error as follows :
    line : 13,
    Error : file not found
    Char : 1
    Code : 800A0035
    Microsoft vbscript runtime er-ror.

    Please do the needful

    thanks
    Santosh

    • mginternet says:

      If you get the Error ‘File not found’, you’ve either not named your nbu file “File.nbu” (without quotes) or the script and the nbu file are not in the same directory.

      Also check that Windows is’nt hiding your file extentions.

  10. Raj says:

    Thank for a nice utility. But it’s showing error as follows :
    line : 13,
    Error : file not found
    Char : 1
    Code : 800A0035
    Microsoft vbscript runtime er-ror.

    Please do the needful

    thanks
    Raj

    • mginternet says:

      Better to use the updated script, Link at the top of the page, but you need to make sure that your NBU file is called File.nbu and is in the same directory you run the script from.

  11. srini says:

    wow! little great handy tool..
    Appreciate it Mike..

  12. Taslimarif says:

    This is a fabulous Converter Update Link

  13. kuldeepsinh says:

    i don’t know which type of script is this how to execute this script.

  14. mginternet says:

    It’s a windows Script…copy and paste the text into notepad and save it with a .VBS extension, make sure you file.nbu file is in the same directory as the saved script and just double click on it to run.

    Also use the updated version. Link above.

  15. Opterron says:

    Thank you very much for this. You are an savior.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s